[Qt-interest] QAIM::headerData() is not tied to QModelIndex?
Kishore
kitts.mailinglists at gmail.com
Mon Aug 16 04:47:09 CEST 2010
On Monday 16 Aug 2010 12:39:52 am Andreas Pakulat wrote:
> 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
display-wise, it does not make sense for columnCount either. Still it exists.
As such, IMHO hierarchy in anything other than the first column does not make
much sense display-wise.
> 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.
Yes. There are workarounds. Since, I am dealing with my custom model and my
own view, i can implement a headerData like mentioned above. But i am trying
to learn more about the MVC architecture.
--
Cheers!
Kishore
More information about the Qt-interest-old
mailing list