diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-09-28 15:59:39 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-09-28 14:10:11 +0000 |
commit | c5050daa16860b800dbc9782e94e0bacffd6bbf2 (patch) | |
tree | bbe8d3cadb3c1d130fc9b0b33a197e6347440938 /src/quicktemplates2 | |
parent | ed9a677c3a27d1c2eeddb71b66f00bfc691df3fd (diff) |
QQuickScrollView: fix binding loop with wrapping TextArea
Start keeping track of the content size only after the component is
complete, to avoid creation time ping pong with content size updates
and content item resizing.
Task-number: QTBUG-62325
Change-Id: I4b75dc398d0b746dd7e0b04291270f47f91bb7e6
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r-- | src/quicktemplates2/qquickscrollview.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/quicktemplates2/qquickscrollview.cpp b/src/quicktemplates2/qquickscrollview.cpp index c05e4848..fa9a6c3b 100644 --- a/src/quicktemplates2/qquickscrollview.cpp +++ b/src/quicktemplates2/qquickscrollview.cpp @@ -205,7 +205,7 @@ bool QQuickScrollViewPrivate::setFlickable(QQuickFlickable *item, bool content) void QQuickScrollViewPrivate::updateContentWidth() { Q_Q(QQuickScrollView); - if (!flickable) + if (!flickable || !componentComplete) return; const qreal cw = flickable->contentWidth(); @@ -219,7 +219,7 @@ void QQuickScrollViewPrivate::updateContentWidth() void QQuickScrollViewPrivate::updateContentHeight() { Q_Q(QQuickScrollView); - if (!flickable) + if (!flickable || !componentComplete) return; const qreal ch = flickable->contentHeight(); @@ -551,8 +551,14 @@ void QQuickScrollView::componentComplete() { Q_D(QQuickScrollView); QQuickControl::componentComplete(); - if (!d->contentItem) + if (!d->contentItem) { d->ensureFlickable(true); + } else { + if (d->contentWidth <= 0) + d->updateContentWidth(); + if (d->contentHeight <= 0) + d->updateContentHeight(); + } } void QQuickScrollView::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) |