diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-12-26 00:31:12 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-12-31 18:44:49 +0000 |
commit | eb9fdf7c0797b52d949ba90d33bf0c9d6e3a806a (patch) | |
tree | d89c82c91334be4f1891aa7ed2af63151f90409d /src/corelib | |
parent | e9ec0ff4bb420fefaec96b8eb1b030aa017d6b00 (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')
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel.cpp | 31 | ||||
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel_p.h | 26 |
2 files changed, 34 insertions, 23 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> { diff --git a/src/corelib/itemmodels/qabstractitemmodel_p.h b/src/corelib/itemmodels/qabstractitemmodel_p.h index 84763dff0d..19ee640f5c 100644 --- a/src/corelib/itemmodels/qabstractitemmodel_p.h +++ b/src/corelib/itemmodels/qabstractitemmodel_p.h @@ -71,7 +71,7 @@ class Q_CORE_EXPORT QAbstractItemModelPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QAbstractItemModel) public: - QAbstractItemModelPrivate() : QObjectPrivate(), supportedDragActions(-1), roleNames(defaultRoleNames()) {} + QAbstractItemModelPrivate(); ~QAbstractItemModelPrivate(); void removePersistentIndexData(QPersistentModelIndexData *data); @@ -103,28 +103,8 @@ public: return (index.row() >= 0) && (index.column() >= 0) && (index.model() == q_func()); } - inline void 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 - */ - inline void 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; - } - } + void invalidatePersistentIndexes(); + void invalidatePersistentIndex(const QModelIndex &index); struct Change { Q_DECL_CONSTEXPR Change() : parent(), first(-1), last(-1), needsAdjust(false) {} |