summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qabstractitemmodel.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-12-26 00:31:12 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-12-31 18:44:49 +0000
commiteb9fdf7c0797b52d949ba90d33bf0c9d6e3a806a (patch)
treed89c82c91334be4f1891aa7ed2af63151f90409d /src/corelib/itemmodels/qabstractitemmodel.cpp
parente9ec0ff4bb420fefaec96b8eb1b030aa017d6b00 (diff)
QAbstractModelPrivate: de-inline functions
These functions have no business being inline. Change-Id: Ib565fb4870f886be133e9360155bd514935e5e72 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/itemmodels/qabstractitemmodel.cpp')
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 38a7bff182..499b465dd9 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -480,6 +480,13 @@ public:
Q_GLOBAL_STATIC(QEmptyItemModel, qEmptyModel)
+QAbstractItemModelPrivate::QAbstractItemModelPrivate()
+ : QObjectPrivate(),
+ supportedDragActions(-1),
+ roleNames(defaultRoleNames())
+{
+}
+
QAbstractItemModelPrivate::~QAbstractItemModelPrivate()
{
}
@@ -489,6 +496,30 @@ QAbstractItemModel *QAbstractItemModelPrivate::staticEmptyModel()
return qEmptyModel();
}
+void QAbstractItemModelPrivate::invalidatePersistentIndexes()
+{
+ foreach (QPersistentModelIndexData *data, persistent.indexes) {
+ data->index = QModelIndex();
+ data->model = 0;
+ }
+ persistent.indexes.clear();
+}
+
+/*!
+ \internal
+ Clean the QPersistentModelIndex relative to the index if there is one.
+ To be used before an index is invalided
+*/
+void QAbstractItemModelPrivate::invalidatePersistentIndex(const QModelIndex &index) {
+ const auto it = persistent.indexes.constFind(index);
+ if (it != persistent.indexes.cend()) {
+ QPersistentModelIndexData *data = *it;
+ persistent.indexes.erase(it);
+ data->index = QModelIndex();
+ data->model = 0;
+ }
+}
+
namespace {
struct DefaultRoleNames : public QHash<int, QByteArray>
{