diff options
Diffstat (limited to 'src/corelib/itemmodels/qabstractitemmodel_p.h')
-rw-r--r-- | src/corelib/itemmodels/qabstractitemmodel_p.h | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel_p.h b/src/corelib/itemmodels/qabstractitemmodel_p.h index c2cbaf5298..19ee640f5c 100644 --- a/src/corelib/itemmodels/qabstractitemmodel_p.h +++ b/src/corelib/itemmodels/qabstractitemmodel_p.h @@ -46,7 +46,8 @@ // // -#include "private/qobject_p.h" +#include "QtCore/qabstractitemmodel.h" +#include "QtCore/private/qobject_p.h" #include "QtCore/qstack.h" #include "QtCore/qset.h" #include "QtCore/qhash.h" @@ -70,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); @@ -102,33 +103,13 @@ 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) { - QHash<QModelIndex, QPersistentModelIndexData *>::iterator it = persistent.indexes.find(index); - if(it != persistent.indexes.end()) { - QPersistentModelIndexData *data = *it; - persistent.indexes.erase(it); - data->index = QModelIndex(); - data->model = 0; - } - } + void invalidatePersistentIndexes(); + void invalidatePersistentIndex(const QModelIndex &index); struct Change { - Change() : first(-1), last(-1) {} - Change(const Change &c) : parent(c.parent), first(c.first), last(c.last), needsAdjust(c.needsAdjust) {} - Change(const QModelIndex &p, int f, int l) : parent(p), first(f), last(l), needsAdjust(false) {} + Q_DECL_CONSTEXPR Change() : parent(), first(-1), last(-1), needsAdjust(false) {} + Q_DECL_CONSTEXPR Change(const QModelIndex &p, int f, int l) : parent(p), first(f), last(l), needsAdjust(false) {} + QModelIndex parent; int first, last; @@ -147,7 +128,7 @@ public: // rowsMoved signal. bool needsAdjust; - bool isValid() { return first >= 0 && last >= 0; } + Q_DECL_CONSTEXPR bool isValid() const { return first >= 0 && last >= 0; } }; QStack<Change> changes; |