Trying to understand QAbstractTableModel more, I came across the virtual methods of rowCount and columnCount which need to be implemented when subclassing QAbstractTableModel.
Take int QAbstractItemModel::columnCount(const QModelIndex &parent = QModelIndex()) const for example, the Qt official documentation says "In most subclasses, the number of columns is independent of the parent."; and gives the following code snippet:
int DomModel::columnCount(const QModelIndex &parent) const
{
return 3;
}
The above-mentioned is straight-forward to understand, which, nonetheless, makes me wonder when the column number will NOT be independent of the param "parent"? I simply cannot come up with a scenario where the column number of a table is not a fixed constant, but a variable depending on the index of a particular cell.
It just doesn't seem like this param is needed at all, can someone share an example where the index param is actually useful?