aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquicklabel.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2018-05-08 14:10:13 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2018-05-08 15:51:09 +0000
commit677d9420622fcc9138606260da380d1d794b6685 (patch)
tree06a64f9b4a57ae4f5941f483d6da64b8b4b13dc0 /src/quicktemplates2/qquicklabel.cpp
parentde9c38dd61ce29f549e2b13871e981209a0fed9e (diff)
Non-QQuickControls: fix background resizing
When this code was copied from QQuickControl, it was accidentally inserted to a wrong place. We need to check widthValid and heightValid _before_ resizing the background. This will be implicitly tested by the next commit that makes the Imagine style use insets. Change-Id: I62532f5fd53d5814b05777459074079a24ed8cc6 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquicklabel.cpp')
-rw-r--r--src/quicktemplates2/qquicklabel.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp
index 0d745d68..9437f9b7 100644
--- a/src/quicktemplates2/qquicklabel.cpp
+++ b/src/quicktemplates2/qquicklabel.cpp
@@ -400,13 +400,13 @@ void QQuickLabel::setBackground(QQuickItem *background)
background->setParentItem(this);
if (qFuzzyIsNull(background->z()))
background->setZ(-1);
- if (isComponentComplete())
- d->resizeBackground();
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
if (p->widthValid || p->heightValid) {
d->extra.value().hasBackgroundWidth = p->widthValid;
d->extra.value().hasBackgroundHeight = p->heightValid;
}
+ if (isComponentComplete())
+ d->resizeBackground();
QQuickControlPrivate::addImplicitSizeListener(background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
}