From eb9fdf7c0797b52d949ba90d33bf0c9d6e3a806a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 26 Dec 2015 00:31:12 +0100 Subject: QAbstractModelPrivate: de-inline functions These functions have no business being inline. Change-Id: Ib565fb4870f886be133e9360155bd514935e5e72 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/itemmodels/qabstractitemmodel.cpp | 31 +++++++++++++++++++++++++++ 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 { 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) {} -- cgit v1.2.3