Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, September 2007
ItemView with different rootItem and headerData function of model


Message 1 in thread

Hello,

may be the solution is very easy and I don't see it. 
I have different views over the same model. 
The different views show different aspects of the model by setting a rootItem for the view. 

eg. 
Root
|-Child 1
|   |-Subchild 11
|   |-Subchild 12
|-Child 2
    |-Subchild 21
    |-Subchild 22

I have two views. One show the List of the direct childs of root (child1 and child2).
The other view shows the subchilds of the marked child, this is done by setting the rootIndex of the second view to the index of Child1 or Child2. 
Now my problem:
Both views should have different headers. But the model only have one function to get the header data by:
QVariant QAbstractItemModel::headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const 
But the model has no idea, which view is asking for the headerData. 
Has anyone an idea how I could get different header data for the different views?
May be I dont see the solution.

Thanks,
Marcel