[Interest] QAbstractItemModel::headerData
andre at familiesomers.nl
andre at familiesomers.nl
Fri Nov 22 20:31:47 CET 2013
Bill Crocker schreef op 22.11.2013 20:19:
> Gang:
>
> I have created my own item model by sub-classing QAbstractItemModel.
>
> Functions like rowCount take a parent index so the model
> knows for which index it is being asked to return the count.
> This is good.
>
> My model is hierarchical and different points in the hierarchy
> have a different number of rows and (especially) columns.
>
> So, how come ::headerData is not passed an index so it knows for
> which parent index it is being asked to return the data?
>
> I'm using Qt 4.7.1
>
> Bill
>
Because Qt does not support vertical headers for tree models (check
QTreeView, there is no vertical header there!) and it does not support
different columns for child items either. While theoretically is should
be possible (after all, QAbstractItemModel really models a nested grid),
the views simply do not support it. There are 3rd party add ons that
provide more sofisticated views that can do this sort of thing, but the
basic Qt model/view system can't handle that. Qt doesn't even handle
cell spanning (QAbstractItemModel::span is not used.)
André
More information about the Interest
mailing list