QAbstractModelPrivate: de-inline functions

These functions have no business being inline.

Change-Id: Ib565fb4870f886be133e9360155bd514935e5e72
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
bb10
Marc Mutz 2015-12-26 00:31:12 +01:00
parent e9ec0ff4bb
commit eb9fdf7c07
2 changed files with 34 additions and 23 deletions

View File

@ -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>
{

View File

@ -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) {}