aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index 56dc946d..d0a08c47 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -219,16 +219,25 @@ void QQuickTextAreaPrivate::resizeBackground()
resizingBackground = true;
+ // When using the attached property TextArea.flickable, we reparent the background out
+ // of TextArea and into the Flickable since we don't want the background to move while
+ // flicking. This means that the size of the background should also follow the size of
+ // the Flickable rather than the size of the TextArea.
+ const auto flickable = qobject_cast<QQuickFlickable *>(background->parentItem());
+
QQuickItemPrivate *p = QQuickItemPrivate::get(background);
if (((!p->widthValid || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
|| (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
+ const qreal bgWidth = flickable ? flickable->width() : width;
background->setX(getLeftInset());
- background->setWidth(width - getLeftInset() - getRightInset());
+ background->setWidth(bgWidth - getLeftInset() - getRightInset());
}
+
if (((!p->heightValid || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
|| (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
+ const qreal bgHeight = flickable ? flickable->height() : height;
background->setY(getTopInset());
- background->setHeight(height - getTopInset() - getBottomInset());
+ background->setHeight(bgHeight - getTopInset() - getBottomInset());
}
resizingBackground = false;