62 Q_DECLARE_PUBLIC(QAbstractItemModel)
65 QAbstractItemModelPrivate();
66 ~QAbstractItemModelPrivate();
68 static const QAbstractItemModelPrivate *get(
const QAbstractItemModel *model) {
return model->d_func(); }
70 void removePersistentIndexData(QPersistentModelIndexData *data);
71 void movePersistentIndexes(
const QList<QPersistentModelIndexData *> &indexes,
int change,
const QModelIndex &parent,
72 Qt::Orientation orientation);
73 void rowsAboutToBeInserted(
const QModelIndex &parent,
int first,
int last);
74 void rowsInserted(
const QModelIndex &parent,
int first,
int last);
75 void rowsAboutToBeRemoved(
const QModelIndex &parent,
int first,
int last);
76 void rowsRemoved(
const QModelIndex &parent,
int first,
int last);
77 void columnsAboutToBeInserted(
const QModelIndex &parent,
int first,
int last);
78 void columnsInserted(
const QModelIndex &parent,
int first,
int last);
79 void columnsAboutToBeRemoved(
const QModelIndex &parent,
int first,
int last);
80 void columnsRemoved(
const QModelIndex &parent,
int first,
int last);
81 static QAbstractItemModel *staticEmptyModel();
82 static bool variantLessThan(
const QVariant &v1,
const QVariant &v2);
84 void itemsAboutToBeMoved(
const QModelIndex &srcParent,
int srcFirst,
int srcLast,
const QModelIndex &destinationParent,
int destinationChild, Qt::Orientation);
85 void itemsMoved(
const QModelIndex &srcParent,
int srcFirst,
int srcLast,
const QModelIndex &destinationParent,
int destinationChild, Qt::Orientation orientation);
86 bool allowMove(
const QModelIndex &srcParent,
int srcFirst,
int srcLast,
const QModelIndex &destinationParent,
int destinationChild, Qt::Orientation orientation);
89 virtual void executePendingOperations()
const;
91 inline QModelIndex createIndex(
int row,
int column,
void *data =
nullptr)
const {
92 return q_func()->createIndex(row, column, data);
95 inline QModelIndex createIndex(
int row,
int column,
int id)
const {
96 return q_func()->createIndex(row, column, id);
99 inline bool indexValid(
const QModelIndex &index)
const {
100 return (index.row() >= 0) && (index.column() >= 0) && (index.model() == q_func());
103 void invalidatePersistentIndexes();
104 void invalidatePersistentIndex(
const QModelIndex &index);
107 constexpr Change() : parent(), first(-1), last(-1), needsAdjust(
false) {}
108 constexpr Change(
const QModelIndex &p,
int f,
int l) : parent(p), first(f), last(l), needsAdjust(
false) {}
128 constexpr bool isValid()
const {
return first >= 0 && last >= 0; }
130 QStack<Change> changes;
134 QMultiHash<QtPrivate::QModelIndexWrapper, QPersistentModelIndexData *> indexes;
135 QStack<QList<QPersistentModelIndexData *>> moved;
136 QStack<QList<QPersistentModelIndexData *>> invalidated;
137 void insertMultiAtEnd(
const QModelIndex& key, QPersistentModelIndexData *data);
140 bool resetting =
false;
142 static const QHash<
int,QByteArray> &defaultRoleNames();
143 static bool isVariantLessThan(
const QVariant &left,
const QVariant &right,
144 Qt::CaseSensitivity cs = Qt::CaseSensitive,
bool isLocaleAware =
false);