aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktableview.cpp
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2025-08-22 09:33:17 +0300
committerTarja Sundqvist <tarja.sundqvist@qt.io>2025-08-22 09:33:17 +0300
commitc6fdadd916a7568c1d71b750e054ca9aa2fd5dfc (patch)
treebbd5690b38a5e0df66dd070a9e9f42b0d1b2b673 /src/quick/items/qquicktableview.cpp
parenta7c766a9863605eb81e8f0cdb4d2b93e087b5bde (diff)
parente436dad999060b92965291b45c0e95a3b93f5866 (diff)
Merge tag 'v6.2.13-lts' into tqtc/lts-6.2-opensourcev6.2.13-lts-lgpl6.2
Qt 6.2.13-lts release Conflicts solved: dependencies.yaml Change-Id: I3cbe1ce4293179888e236dd1a3a299cd2c66c950
Diffstat (limited to 'src/quick/items/qquicktableview.cpp')
-rw-r--r--src/quick/items/qquicktableview.cpp34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp
index 9b0334b851..490e89acad 100644
--- a/src/quick/items/qquicktableview.cpp
+++ b/src/quick/items/qquicktableview.cpp
@@ -3297,11 +3297,18 @@ void QQuickTableViewPrivate::syncSyncView()
q->setColumnSpacing(syncView->columnSpacing());
updateContentWidth();
- if (syncView->leftColumn() != q->leftColumn()) {
- // The left column is no longer the same as the left
- // column in syncView. This requires a rebuild.
- scheduledRebuildOptions |= QQuickTableViewPrivate::RebuildOption::CalculateNewTopLeftColumn;
- scheduledRebuildOptions.setFlag(RebuildOption::ViewportOnly);
+ if (scheduledRebuildOptions & RebuildOption::LayoutOnly) {
+ if (syncView->leftColumn() != q->leftColumn()
+ || syncView->d_func()->loadedTableOuterRect.left() != loadedTableOuterRect.left()) {
+ // The left column is no longer the same, or at the same pos, as the left column in
+ // syncView. This can happen if syncView did a relayout that caused its left column
+ // to be resized so small that it ended up outside the viewport. It can also happen
+ // if the syncView loaded and unloaded columns after the relayout. We therefore need
+ // to sync our own left column and pos to be the same, which we do by rebuilding the
+ // whole viewport instead of just doing a plain LayoutOnly.
+ scheduledRebuildOptions |= QQuickTableViewPrivate::RebuildOption::CalculateNewTopLeftColumn;
+ scheduledRebuildOptions.setFlag(RebuildOption::ViewportOnly);
+ }
}
}
@@ -3309,11 +3316,18 @@ void QQuickTableViewPrivate::syncSyncView()
q->setRowSpacing(syncView->rowSpacing());
updateContentHeight();
- if (syncView->topRow() != q->topRow()) {
- // The top row is no longer the same as the top
- // row in syncView. This requires a rebuild.
- scheduledRebuildOptions |= QQuickTableViewPrivate::RebuildOption::CalculateNewTopLeftRow;
- scheduledRebuildOptions.setFlag(RebuildOption::ViewportOnly);
+ if (scheduledRebuildOptions & RebuildOption::LayoutOnly) {
+ if (syncView->topRow() != q->topRow()
+ || syncView->d_func()->loadedTableOuterRect.top() != loadedTableOuterRect.top()) {
+ // The top row is no longer the same, or at the same pos, as the top row in
+ // syncView. This can happen if syncView did a relayout that caused its top row
+ // to be resized so small that it ended up outside the viewport. It can also happen
+ // if the syncView loaded and unloaded rows after the relayout. We therefore need
+ // to sync our own top row and pos to be the same, which we do by rebuilding the
+ // whole viewport instead of just doing a plain LayoutOnly.
+ scheduledRebuildOptions |= QQuickTableViewPrivate::RebuildOption::CalculateNewTopLeftRow;
+ scheduledRebuildOptions.setFlag(RebuildOption::ViewportOnly);
+ }
}
}