aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickcontrol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quicktemplates2/qquickcontrol.cpp')
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index 346eb8fba0..e0d2740519 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -348,15 +348,26 @@ void QQuickControlPrivate::resizeBackground()
resizingBackground = true;
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ bool changeWidth = false;
+ bool changeHeight = false;
if (((!p->widthValid() || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
|| (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
background->setX(getLeftInset());
- background->setWidth(width - getLeftInset() - getRightInset());
+ changeWidth = !p->width.hasBinding();
}
if (((!p->heightValid() || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
|| (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
background->setY(getTopInset());
- background->setHeight(height - getTopInset() - getBottomInset());
+ changeHeight = !p->height.hasBinding();
+ }
+ if (changeHeight || changeWidth) {
+ auto newWidth = changeWidth ?
+ width.valueBypassingBindings() - getLeftInset() - getRightInset() :
+ p->width.valueBypassingBindings();
+ auto newHeight = changeHeight ?
+ height.valueBypassingBindings() - getTopInset() - getBottomInset() :
+ p->height.valueBypassingBindings();
+ background->setSize({newWidth, newHeight});
}
resizingBackground = false;