[Qt-interest] QAIM::headerData() is not tied to QModelIndex?

Andreas Pakulat apaku at gmx.de
Sun Aug 15 21:09:52 CEST 2010


On 15.08.10 18:01:20, Kishore wrote:
> Why does the headerData() take section parameter and not a QModelIndex?
> 
> I know this is not how QAbstractItemModel is commonly used but QAIM is designed in such a way that every modelindex can again have children and so on... ie. there can be 
> a table within a table. So essentially, in a tree like structure, a child can have more columns than a parent and with a really different set of headerData as well. A more 
> relevant API would be something like:
> 
> QAIM::headerData ( const QModelIndex &index, Qt::Orientation orientation, int role = Qt::DisplayRole ) const
> 
> just the way it is currently with columnCount().

This doesn't really make sense display-wise. The header is global so you
cannot have different strings anyway depending on some row information.
Thats for existing views. You can of course write your own view who uses
a special data role with data() to fetch the header information.

Andreas

-- 
You'll be called to a post requiring ability in handling groups of people.



More information about the Qt-interest-old mailing list