diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-08-21 12:42:56 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-08-27 11:48:26 +0000 |
commit | 4dc3582a1ee332bf8b577bb974f29e7692df85e9 (patch) | |
tree | 396a0622c9b6887a2ab1fa5217a54246a9b5d9d9 /src/quick/items/qquicktableview_p_p.h | |
parent | c9a35639d43cfa0673675923415d57ff155ccd45 (diff) |
QQuickTableView: rename to scheduleRebuildTable, and add rebuild options
Rebuilding the table from scratch whenever e.g the model adds a new
row or column is slow and unnecessary. What happens is that we always
rebuild the table from the origin, and continue load and unload edges
until the loaded rows and columns overlaps with the viewport. This
can be slow if you are e.g at row 1000 when you start to rebuild.
Instead we can just start from current position in the viewport.
So add some options to control what needs to be done.
Note: This patch doesn't change any logic as it stands. But the options
will be used in a subsequent patch.
Change-Id: I9705dbae3a2c04e7e7189ec453756358a1b9fc14
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquicktableview_p_p.h')
-rw-r--r-- | src/quick/items/qquicktableview_p_p.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/quick/items/qquicktableview_p_p.h b/src/quick/items/qquicktableview_p_p.h index 7241fac7d3..81127adae4 100644 --- a/src/quick/items/qquicktableview_p_p.h +++ b/src/quick/items/qquicktableview_p_p.h @@ -175,6 +175,13 @@ public: Done }; + enum class RebuildOption { + None = 0, + ViewportOnly = 0x1, + All = 0x2, + }; + Q_DECLARE_FLAGS(RebuildOptions, RebuildOption) + public: QQuickTableViewPrivate(); ~QQuickTableViewPrivate() override; @@ -209,6 +216,9 @@ public: QSize tableSize; RebuildState rebuildState = RebuildState::Done; + RebuildOptions rebuildOptions = RebuildOption::All; + RebuildOptions scheduledRebuildOptions = RebuildOption::All; + TableEdgeLoadRequest loadRequest; QPoint contentSizeBenchMarkPoint = QPoint(-1, -1); @@ -307,7 +317,7 @@ public: void beginRebuildTable(); void layoutAfterLoadingInitialTable(); - void invalidateTable(); + void scheduleRebuildTable(QQuickTableViewPrivate::RebuildOptions options); void invalidateColumnRowPositions(); void createWrapperModel(); |