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);
90 virtual void executePendingOperations()
const;
92 inline QModelIndex createIndex(
int row,
int column,
void *data =
nullptr)
const {
93 return q_func()->createIndex(row, column, data);
96 inline QModelIndex createIndex(
int row,
int column,
int id)
const {
97 return q_func()->createIndex(row, column, id);
100 inline bool indexValid(
const QModelIndex &index)
const {
101 return (index.row() >= 0) && (index.column() >= 0) && (index.model() == q_func());
104 void invalidatePersistentIndexes();
105 void invalidatePersistentIndex(
const QModelIndex &index);
108 constexpr Change() : parent(), first(-1), last(-1), needsAdjust(
false) {}
109 constexpr Change(
const QModelIndex &p,
int f,
int l) : parent(p), first(f), last(l), needsAdjust(
false) {}
129 constexpr bool isValid()
const {
return first >= 0 && last >= 0; }
131 QStack<Change> changes;
135 QMultiHash<QtPrivate::QModelIndexWrapper, QPersistentModelIndexData *> indexes;
136 QStack<QList<QPersistentModelIndexData *>> moved;
137 QStack<QList<QPersistentModelIndexData *>> invalidated;
138 void insertMultiAtEnd(
const QModelIndex& key, QPersistentModelIndexData *data);
141 bool resetting =
false;
143 static const QHash<
int,QByteArray> &defaultRoleNames();
144 static bool isVariantLessThan(
const QVariant &left,
const QVariant &right,
145 Qt::CaseSensitivity cs = Qt::CaseSensitive,
bool isLocaleAware =
false);