[Qt-interest] QAIM::headerData() is not tied to QModelIndex?
Andreas Pakulat
apaku at gmx.de
Mon Aug 16 13:01:20 CEST 2010
On 16.08.10 08:17:09, Kishore wrote:
> 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.
No it completely does, different subtree's may have different number of
columns. The header in the view is an optional component, so it might not
be shown in such a case where each index has a different number of columns.
And having one subtree with less columns than another can also improve
performance as the view doesn't have to fetch data for cells that don't
exist in the model anyway.
> As such, IMHO hierarchy in anything other than the first column does not make
> much sense display-wise.
Yes, thats right, subtree's in Qt MVC only make sense in the first column.
See also the modeltest in the Labs repo which explicitly tests for this.
Andreas
--
You dialed 5483.
More information about the Qt-interest-old
mailing list