aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-08-22 10:56:45 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-08-24 17:40:35 +0000
commitdd9a6999b674a9197eabbea96b1e5a34c22a8aab (patch)
tree73cb089700752634b860e1f2bb599596daa2a1ac
parent732c25029ec95feb27a607ef19bb3b7423a955a1 (diff)
QQuickTableView: decide whether to reuse items from calling location
This patch opens up the possibility to specify the reuse flag from the calling location. It doesn't change the current logic, it's just a preparation to simplify subsequent patches Change-Id: Id00dc8a354140b0e511564c40066d3a97a773c5c Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r--src/quick/items/qquicktableview.cpp8
-rw-r--r--src/quick/items/qquicktableview_p_p.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/quick/items/qquicktableview.cpp b/src/quick/items/qquicktableview.cpp
index 9208ea1f23..880aa5efd5 100644
--- a/src/quick/items/qquicktableview.cpp
+++ b/src/quick/items/qquicktableview.cpp
@@ -102,7 +102,7 @@ QQuickTableViewPrivate::QQuickTableViewPrivate()
QQuickTableViewPrivate::~QQuickTableViewPrivate()
{
- releaseLoadedItems();
+ releaseLoadedItems(QQmlTableInstanceModel::NotReusable);
if (tableModel)
delete tableModel;
}
@@ -375,13 +375,13 @@ FxTableItem *QQuickTableViewPrivate::loadFxTableItem(const QPoint &cell, QQmlInc
return item;
}
-void QQuickTableViewPrivate::releaseLoadedItems() {
+void QQuickTableViewPrivate::releaseLoadedItems(QQmlTableInstanceModel::ReusableFlag reusableFlag) {
// Make a copy and clear the list of items first to avoid destroyed
// items being accessed during the loop (QTBUG-61294)
auto const tmpList = loadedItems;
loadedItems.clear();
for (FxTableItem *item : tmpList)
- releaseItem(item, QQmlTableInstanceModel::NotReusable);
+ releaseItem(item, reusableFlag);
}
void QQuickTableViewPrivate::releaseItem(FxTableItem *fxTableItem, QQmlTableInstanceModel::ReusableFlag reusableFlag)
@@ -934,7 +934,7 @@ void QQuickTableViewPrivate::beginRebuildTable()
if (loadRequest.isActive())
cancelLoadRequest();
- releaseLoadedItems();
+ releaseLoadedItems(QQmlTableInstanceModel::NotReusable);
loadedTable = QRect();
loadedTableOuterRect = QRect();
diff --git a/src/quick/items/qquicktableview_p_p.h b/src/quick/items/qquicktableview_p_p.h
index 1ba18480ba..7241fac7d3 100644
--- a/src/quick/items/qquicktableview_p_p.h
+++ b/src/quick/items/qquicktableview_p_p.h
@@ -289,7 +289,7 @@ public:
FxTableItem *loadFxTableItem(const QPoint &cell, QQmlIncubator::IncubationMode incubationMode);
void releaseItem(FxTableItem *fxTableItem, QQmlTableInstanceModel::ReusableFlag reusableFlag);
- void releaseLoadedItems();
+ void releaseLoadedItems(QQmlTableInstanceModel::ReusableFlag reusableFlag);
void unloadItem(const QPoint &cell);
void unloadItems(const QLine &items);