33 Q_PROPERTY(
QModelIndex rootIndex READ rootIndex WRITE setRootIndex RESET resetRootIndex NOTIFY rootIndexChanged FINAL)
43 void resetRootIndex();
59 QHash<int, QByteArray> roleNames()
const override;
65 void clearModelData();
76 void showModelTopLevelItems(
bool doInsertRows =
true);
77 void showModelChildItems(
const TreeItem &parent,
int start,
int end,
bool doInsertRows =
true,
bool doExpandPendingRows =
true);
80 void expandPendingRows(
bool doInsertRows =
true);
82 void removeVisibleRows(
int startIndex,
int endIndex,
bool doRemoveRows =
true);
85 bool testConsistency(
bool dumpOnFail =
false)
const;
100 bool isExpanded(
int row)
const;
101 bool hasChildren(
int row)
const;
102 bool hasSiblings(
int row)
const;
103 int depthAtRow(
int row)
const;
104 void expandRow(
int n);
105 void expandRecursively(
int row,
int depth);
106 void collapseRow(
int n);
107 void collapseRecursively(
int row);
110 void modelHasBeenDestroyed();
111 void modelHasBeenReset();
112 void modelDataChanged(
const QModelIndex &topLeft,
const QModelIndex &bottomRight,
const QVector<int> &roles);
116 void modelRowsAboutToBeMoved(
const QModelIndex & sourceParent,
int sourceStart,
int sourceEnd,
const QModelIndex & destinationParent,
int destinationRow);
119 void modelRowsMoved(
const QModelIndex & sourceParent,
int sourceStart,
int sourceEnd,
const QModelIndex & destinationParent,
int destinationRow);
138 return this->index ==
other.index;
142 struct DataChangedParams {
148 struct SignalFreezer {
150 m_parent->enableSignalAggregation();
152 ~SignalFreezer() { m_parent->disableSignalAggregation(); }
158 void enableSignalAggregation();
159 void disableSignalAggregation();
160 bool isAggregatingSignals()
const {
return m_signalAggregatorStack > 0; }
163 const QVector<int> &roles);
164 void emitQueuedSignals();
165 void connectToModel();
167 QPointer<QAbstractItemModel> m_model =
nullptr;
169 QList<TreeItem> m_items;
170 QSet<QPersistentModelIndex> m_expandedItems;
171 QList<TreeItem> m_itemsToExpand;
172 mutable int m_lastItemIndex = 0;
173 bool m_visibleRowsMoved =
false;
174 bool m_modelLayoutChanged =
false;
175 int m_signalAggregatorStack = 0;
176 QVector<DataChangedParams> m_queuedDataChanged;
177 std::array<QMetaObject::Connection, 15> m_connections;