From dafdc9d701b0b3a33e3eac0a723d80717a02f4f8 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 6 May 2019 19:42:49 +0200 Subject: QQuickTableView: sync viewport rect with syncView when rebuilding When moving contentX/Y, we also need to ensure that the viewport rect reflects the change. Otherwise we'll end up loading rows and columns somewhere else then under the viewport. Change-Id: Ifbd3d66b9b3a822414aefde9b5bd088274dfa2ad Reviewed-by: Mitch Curtis --- src/quick/items/qquicktableview.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/quick') diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp index 48736f8d47..af4373317b 100644 --- a/src/quick/items/qquicktableview.cpp +++ b/src/quick/items/qquicktableview.cpp @@ -1644,10 +1644,15 @@ void QQuickTableViewPrivate::beginRebuildTable() loadedTableInnerRect = QRect(); clearEdgeSizeCache(); - if (syncHorizontally) + if (syncHorizontally) { setLocalViewportX(syncView->contentX()); - if (syncVertically) + viewportRect.moveLeft(syncView->d_func()->viewportRect.left()); + } + + if (syncVertically) { setLocalViewportY(syncView->contentY()); + viewportRect.moveTop(syncView->d_func()->viewportRect.top()); + } if (!model) { qCDebug(lcTableViewDelegateLifecycle()) << "no model found, leaving table empty"; -- cgit v1.2.3