63 Q_DECLARE_PUBLIC(QAbstractItemModel)
66 QAbstractItemModelPrivate();
67 ~QAbstractItemModelPrivate();
69 static const QAbstractItemModelPrivate *get(
const QAbstractItemModel *model) {
return model->d_func(); }
71 void removePersistentIndexData(QPersistentModelIndexData *data);
72 void movePersistentIndexes(
const QList<QPersistentModelIndexData *> &indexes,
int change,
const QModelIndex &parent,
73 Qt::Orientation orientation);
74 void rowsAboutToBeInserted(
const QModelIndex &parent,
int first,
int last);
75 void rowsInserted(
const QModelIndex &parent,
int first,
int last);
76 void rowsAboutToBeRemoved(
const QModelIndex &parent,
int first,
int last);
77 void rowsRemoved(
const QModelIndex &parent,
int first,
int last);
78 void columnsAboutToBeInserted(
const QModelIndex &parent,
int first,
int last);
79 void columnsInserted(
const QModelIndex &parent,
int first,
int last);
80 void columnsAboutToBeRemoved(
const QModelIndex &parent,
int first,
int last);
81 void columnsRemoved(
const QModelIndex &parent,
int first,
int last);
82 static QAbstractItemModel *staticEmptyModel();
83 static bool variantLessThan(
const QVariant &v1,
const QVariant &v2);
85 void itemsAboutToBeMoved(
const QModelIndex &srcParent,
int srcFirst,
int srcLast,
const QModelIndex &destinationParent,
int destinationChild, Qt::Orientation);
86 void itemsMoved(
const QModelIndex &srcParent,
int srcFirst,
int srcLast,
const QModelIndex &destinationParent,
int destinationChild, Qt::Orientation orientation);
87 bool allowMove(
const QModelIndex &srcParent,
int srcFirst,
int srcLast,
const QModelIndex &destinationParent,
int destinationChild, Qt::Orientation orientation);
88 bool dropOnItem(
const QModelIndex &index, QDataStream &stream);
91 virtual void executePendingOperations()
const;
93 inline QModelIndex createIndex(
int row,
int column,
void *data =
nullptr)
const {
94 return q_func()->createIndex(row, column, data);
97 inline QModelIndex createIndex(
int row,
int column,
int id)
const {
98 return q_func()->createIndex(row, column, id);
101 inline bool indexValid(
const QModelIndex &index)
const {
102 return (index.row() >= 0) && (index.column() >= 0) && (index.model() == q_func());
105 void invalidatePersistentIndexes();
106 void invalidatePersistentIndex(
const QModelIndex &index);
109 constexpr Change() : parent(), first(-1), last(-1), needsAdjust(
false) {}
110 constexpr Change(
const QModelIndex &p,
int f,
int l) : parent(p), first(f), last(l), needsAdjust(
false) {}
130 constexpr bool isValid()
const {
return first >= 0 && last >= 0; }
132 QStack<Change> changes;
136 QMultiHash<QtPrivate::QModelIndexWrapper, QPersistentModelIndexData *> indexes;
137 QStack<QList<QPersistentModelIndexData *>> moved;
138 QStack<QList<QPersistentModelIndexData *>> invalidated;
139 void insertMultiAtEnd(
const QModelIndex& key, QPersistentModelIndexData *data);
142 bool resetting =
false;
144 static const QHash<
int,QByteArray> &defaultRoleNames();