aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktableview_p_p.h
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-08-21 13:08:59 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-08-27 11:48:29 +0000
commit267eb009ee77dd52a3764a87594f4a7385f26b4f (patch)
tree2263e893ef60331e4afc026f02f246b3fe497383 /src/quick/items/qquicktableview_p_p.h
parent4dc3582a1ee332bf8b577bb974f29e7692df85e9 (diff)
QQuickTableView: handle RebuildOption::ViewportOnly
When rebuildOptions have ViewportOnly set, we now let the top-left item be the same as before (and at the same position as before), and start rebuilding from there. This will greatly increase performance if e.g the table has been flicked far down to row 1000 when the rebuild needs to happen (e.g because the model got a new row). Change-Id: I30beb34a7beccedff8dc406f9a524119a2893eb3 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.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/quick/items/qquicktableview_p_p.h b/src/quick/items/qquicktableview_p_p.h
index 81127adae4..1e8c10c285 100644
--- a/src/quick/items/qquicktableview_p_p.h
+++ b/src/quick/items/qquicktableview_p_p.h
@@ -86,7 +86,7 @@ public:
// done by QQuickTableView.
public:
- void begin(const QPoint &cell, QQmlIncubator::IncubationMode incubationMode)
+ void begin(const QPoint &cell, const QPointF &pos, QQmlIncubator::IncubationMode incubationMode)
{
Q_ASSERT(!active);
active = true;
@@ -95,6 +95,7 @@ public:
mode = incubationMode;
cellCount = 1;
currentIndex = 0;
+ startPos = pos;
qCDebug(lcTableViewDelegateLifecycle()) << "begin top-left:" << toString();
}
@@ -125,6 +126,8 @@ public:
inline Qt::Edge edge() { return tableEdge; }
inline QQmlIncubator::IncubationMode incubationMode() { return mode; }
+ inline QPointF startPosition() { return startPos; }
+
QString toString()
{
QString str;
@@ -154,6 +157,7 @@ public:
int cellCount = 0;
bool active = false;
QQmlIncubator::IncubationMode mode = QQmlIncubator::AsynchronousIfNested;
+ QPointF startPos;
QPoint cellAt(int index)
{
@@ -304,7 +308,7 @@ public:
void unloadItem(const QPoint &cell);
void unloadItems(const QLine &items);
- void loadInitialTopLeftItem();
+ void loadInitialTopLeftItem(const QPoint &cell, const QPointF &pos);
void loadEdge(Qt::Edge edge, QQmlIncubator::IncubationMode incubationMode);
void unloadEdge(Qt::Edge edge);
void loadAndUnloadVisibleEdges();