PDA

View Full Version : QTreeView::isFirstColumnSpanned() - how to use it with a custom model??



edice
24th September 2009, 03:11
Hi,

I have a QTreeView and a custom model.
I would like all of my root nodes to have their first column spanned. How do I do it?

I see there is QTreeView::isFirstColumnSpanned(), but its virtual so I can't override that. I can only use
QTreeView::setFirstColumnSpanned(int row, QModelIndex, bool), but that means I need to know in advance how many rows my model has, AND get all their indexes, then call this function multiple times. And then do it again whenever I change the model's contents.

Seems like a crazy design? Why isn't there a 'FirstColumnSpannedRole' or something like that? There are all sorts of other display-orientated roles that I could use.

thanks,
Paul

caduel
24th September 2009, 14:44
QTreeView::isFirstColumnSpanned() is not related to a model but purely internal to QTreeView.

I agree with you that this is not really convenient (esp. that you have to re-set it when the model is changed, or filtered...).

As you can see by the existence of QAbstractItemModel::span() there are plans for proper support of that feature. But these plans have been plans for a long time now...