28class QItemSelectionModelPrivate:
public QObjectPrivate
30 Q_DECLARE_PUBLIC(QItemSelectionModel)
32 QItemSelectionModelPrivate()
33 : currentCommand(QItemSelectionModel::NoUpdate),
34 tableSelected(
false), tableColCount(0), tableRowCount(0) {}
35 ~QItemSelectionModelPrivate() override;
37 QItemSelection expandSelection(
const QItemSelection &selection,
38 QItemSelectionModel::SelectionFlags command)
const;
40 void initModel(QAbstractItemModel *model);
42 void rowsAboutToBeRemoved(
const QModelIndex &parent,
int start,
int end);
43 void columnsAboutToBeRemoved(
const QModelIndex &parent,
int start,
int end);
44 void rowsAboutToBeInserted(
const QModelIndex &parent,
int start,
int end);
45 void columnsAboutToBeInserted(
const QModelIndex &parent,
int start,
int end);
46 void layoutAboutToBeChanged(
const QList<QPersistentModelIndex> &parents, QAbstractItemModel::LayoutChangeHint hint);
47 void triggerLayoutToBeChanged()
49 layoutAboutToBeChanged(QList<QPersistentModelIndex>(), QAbstractItemModel::NoLayoutChangeHint);
52 void layoutChanged(
const QList<QPersistentModelIndex> &parents, QAbstractItemModel::LayoutChangeHint hint);
53 void triggerLayoutChanged()
55 layoutChanged(QList<QPersistentModelIndex>(), QAbstractItemModel::NoLayoutChangeHint);
58 void modelDestroyed();
60 inline void remove(QList<QItemSelectionRange> &r)
62 QList<QItemSelectionRange>::const_iterator it = r.constBegin();
63 for (; it != r.constEnd(); ++it)
64 ranges.removeAll(*it);
67 inline void finalize()
69 ranges.merge(currentSelection, currentCommand);
70 if (!currentSelection.isEmpty())
71 currentSelection.clear();
74 void setModel(QAbstractItemModel *mod) { q_func()->setModel(mod); }
75 void disconnectModel();
76 void modelChanged(QAbstractItemModel *mod) { Q_EMIT q_func()->modelChanged(mod); }
77 Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QItemSelectionModelPrivate, QAbstractItemModel *, model,
78 &QItemSelectionModelPrivate::setModel,
79 &QItemSelectionModelPrivate::modelChanged,
nullptr)
81 QItemSelection ranges;
82 QItemSelection currentSelection;
83 QPersistentModelIndex currentIndex;
84 QItemSelectionModel::SelectionFlags currentCommand;
85 QList<QPersistentModelIndex> savedPersistentIndexes;
86 QList<QPersistentModelIndex> savedPersistentCurrentIndexes;
87 QList<std::pair<QPersistentModelIndex, uint>> savedPersistentRowLengths;
88 QList<std::pair<QPersistentModelIndex, uint>> savedPersistentCurrentRowLengths;
91 QPersistentModelIndex tableParent;
92 int tableColCount, tableRowCount;
93 std::array<QMetaObject::Connection, 12> connections;