diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-05-15 13:48:36 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-05-16 06:41:44 +0000 |
commit | f61a49efa2172dda996f33a7420b81fe33ad1692 (patch) | |
tree | acec68962bf623d25e3ac24fec68319bea396db2 /src/quick | |
parent | f1049d45bf85c09bff7deceda5ba8655792260ef (diff) |
TableView: ensure we don't update viewport rect while loading edges
Flickable will change the viewport recursively while we're
loading/unloading rows/columns. This will confuse TableView
and might cause it to freeze. The correct time to update
the internal viewport rect is from inside updatePolish(), where
we have better control over the current state.
Change-Id: I94f964b8b0f6920ffe31cedd7a461f3853998be3
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquicktableview.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index c7ecf754ea..a24bd4db23 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -1058,6 +1058,7 @@ void QQuickTableViewPrivate::updatePolish() // Whenever something changes, e.g viewport moves, spacing is set to a // new value, model changes etc, this function will end up being called. Here // we check what needs to be done, and load/unload cells accordingly. + Q_Q(QQuickTableView); if (loadRequest.isActive()) { // We're currently loading items async to build a new edge in the table. We see the loading @@ -1067,6 +1068,9 @@ void QQuickTableViewPrivate::updatePolish() return; } + // viewportrect describes the part of the content view that is actually visible + viewportRect = QRectF(q->contentX(), q->contentY(), q->width(), q->height()); + if (tableInvalid) { beginRebuildTable(); if (loadRequest.isActive()) @@ -1393,8 +1397,9 @@ void QQuickTableView::viewportMoved(Qt::Orientations orientation) { Q_D(QQuickTableView); QQuickFlickable::viewportMoved(orientation); - - d->viewportRect = QRectF(contentX(), contentY(), width(), height()); + // We update the viewport rect from within updatePolish to + // ensure that we update when we're ready to update, and not + // while we're in the middle of loading/unloading edges. d->updatePolish(); } |