diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-05-08 14:10:13 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-05-08 15:51:09 +0000 |
commit | 677d9420622fcc9138606260da380d1d794b6685 (patch) | |
tree | 06a64f9b4a57ae4f5941f483d6da64b8b4b13dc0 /src/quicktemplates2 | |
parent | de9c38dd61ce29f549e2b13871e981209a0fed9e (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')
-rw-r--r-- | src/quicktemplates2/qquicklabel.cpp | 4 | ||||
-rw-r--r-- | src/quicktemplates2/qquicktextarea.cpp | 4 | ||||
-rw-r--r-- | src/quicktemplates2/qquicktextfield.cpp | 4 |
3 files changed, 6 insertions, 6 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); } diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp index 5e633a33..bd023610 100644 --- a/src/quicktemplates2/qquicktextarea.cpp +++ b/src/quicktemplates2/qquicktextarea.cpp @@ -610,13 +610,13 @@ void QQuickTextArea::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); } diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp index 2882edca..00b173ce 100644 --- a/src/quicktemplates2/qquicktextfield.cpp +++ b/src/quicktemplates2/qquicktextfield.cpp @@ -493,13 +493,13 @@ void QQuickTextField::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); } |