We are implementing an QAbstractItemModel structure as shown in diagram below and would like that;
- node A to contains 3 data columns
- node B to contains 8 data columns
- node C to contains 5 data columns
However, when looking at the signature for QAbstractItemModel::columnCount it is unclear how to implement the above requirement. It is difficult to determine that node A shall have 3 columns, node B shall have 8 columns and node C shall have 5 columns give only the parent index.
int QAbstractItemModel::columnCount(const QModelIndex &parent = QModelIndex()) const
Returns the number of columns for the children of the given parent.
In most subclasses, the number of columns is independent of the parent.
This type of problem must surely be possible to solve using QAbstractItemModel. What am I doing wrong or not thinking about? Appreciate any input on the matter.