aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktableview_p_p.h
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2018-06-23 11:20:11 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-07-17 15:11:30 +0000
commita0bd47855004f19b5b4c1bfcee9f170443393bd3 (patch)
treef50fee702693fb2abe1aee2d657c03e7f63640a3 /src/quick/items/qquicktableview_p_p.h
parente137877eaaa3975a6769fd2dd574bd75876fcfa5 (diff)
QQuikTableView: use TableViewModel instead of QQmlDelegateModel
Swap out QQmlDelegateModel in favor of the new QQmlTableInstanceModel. QQmlTableInstanceModel skips using QQmlChangeSets all together, and lets us subscribe to model changes directly from the underlying QAIM instead. This will make it much easier to handle model changes more gracefully later. Change-Id: I0315e91f39671744fb48d1869e4b73b1becbb929 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quick/items/qquicktableview_p_p.h')
-rw-r--r--src/quick/items/qquicktableview_p_p.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/quick/items/qquicktableview_p_p.h b/src/quick/items/qquicktableview_p_p.h
index 9376ad386c..4dcf421183 100644
--- a/src/quick/items/qquicktableview_p_p.h
+++ b/src/quick/items/qquicktableview_p_p.h
@@ -51,7 +51,7 @@
#include "qquicktableview_p.h"
#include <QtCore/qtimer.h>
-#include <QtQml/private/qqmldelegatemodel_p.h>
+#include <QtQml/private/qqmltableinstancemodel_p.h>
#include <QtQml/private/qqmlincubator_p.h>
#include <QtQml/private/qqmlchangeset_p.h>
#include <QtQml/qqmlinfo.h>
@@ -194,12 +194,12 @@ public:
public:
QHash<int, FxTableItem *> loadedItems;
- // model, delegateModel and modelVariant all points to the same model. modelVariant
- // is the model assigned by the user. And delegateModel is the wrapper model we create
+ // model, tableModel and modelVariant all point to the same model. modelVariant
+ // is the model assigned by the user. And tableModel is the wrapper model we create
// around it. But if the model is an instance model directly, we cannot wrap it, so
// we need a pointer for that case as well.
QQmlInstanceModel* model = nullptr;
- QPointer<QQmlDelegateModel> delegateModel = nullptr;
+ QPointer<QQmlTableInstanceModel> tableModel = nullptr;
QVariant modelVariant;
// loadedTable describes the table cells that are currently loaded (from top left
@@ -316,6 +316,15 @@ public:
void itemCreatedCallback(int modelIndex, QObject *object);
void modelUpdated(const QQmlChangeSet &changeSet, bool reset);
+ void connectToModel();
+ void disconnectFromModel();
+
+ void dataChangedCallback(const QModelIndex &begin, const QModelIndex &end, const QVector<int> &roles);
+ void rowsInsertedCallback(const QModelIndex &parent, int begin, int end);
+ void rowsRemovedCallback(const QModelIndex &parent, int begin, int end);
+ void columnsInsertedCallback(const QModelIndex &parent, int begin, int end);
+ void columnsRemovedCallback(const QModelIndex &parent, int begin, int end);
+
inline QString tableLayoutToString() const;
void dumpTable() const;
};