[Qt5-feedback] QAIM::headerData()

Andre Somers andre at familiesomers.nl
Tue Jul 26 08:57:29 CEST 2011


Op 25-7-2011 13:18, Kishore Jonnalagadda schreef:
>
> Does anyone have an opinion on this? It was once discussed before on 
> qt-interest[1]
>
One other opinion then:

I think it is the wrong road. It further complicates the already overly 
complex model, and there are no views to support this functionality 
anyway. So what is the point?

I think that if you need different headers at different levels of your 
tree, you probably need different models completely. Remember, a model 
is only supposed to be an interface to your underlying data store (I am 
using "store" here to prevent confusion with the model in the sense of 
the QAIM). There is no real need to have one single model represent all 
aspects of your whole data store in one go. Instead, create multiple 
models on top of your data store to represent the different aspects in a 
consistent way.

I think it is a mistake in the current QAIM design, that all cells have 
a separate QModelIndex, and that all cells can have multiple rows and 
columns of children, and that the number of columns does not need to 
match between them. It is extremely flexible, but it complicates the 
structure needlessly. The Qt model/view structure needs, in my opinion, 
not cater to the very exotic situation where people want very complex 
views with multiple levels of headers and the likes. Let that be the 
domain of 3rd party components; they are available if you need them. Let 
us not reinforce that design mistake by making headerData more complex 
than it needs to be.

I vote against.

André

> [1] 
> http://lists.qt.nokia.com/pipermail/qt-interest/2010-August/026565.html
>
> Kishore
>
> On Jul 20, 2011 5:42 PM, "Kishore Jonnalagadda" 
> <kitts.mailinglists at gmail.com <mailto:kitts.mailinglists at gmail.com>> 
> wrote:
> > On Jul 20, 2011 5:38 PM, "Kishore Jonnalagadda" <
> > kitts.mailinglists at gmail.com <mailto:kitts.mailinglists at gmail.com>> 
> wrote:
> >>
> >> I have been using QAIM in the last few months and one inconsistency 
> I find
> > is in the headerData() API. I would like to see the api being 
> modified from
> >>
> >> virtual QVariant headerData ( int section, Qt::Orientation orientation,
> > int role = Qt::DisplayRole ) const
> >>
> >> to
> >>
> >> virtual QVariant headerData ( const QModelIndex & parent, int section,
> > Qt::Orientation orientation, int role = Qt::DisplayRole ) const
> >>
> >> just as it is for columnCount() and other API. In my use case, I am 
> using
> > QAIM as an aggregating model and hence it is very much possible that the
> > models being aggregated have different header data.
> >
> > Also this change can be made source compatible by making index the last
> > parameter with a default invalid (root) index.
> >> Kishore
>
>
> _______________________________________________
> Qt5-feedback mailing list
> Qt5-feedback at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt5-feedback/attachments/20110726/527be3cb/attachment.html 


More information about the Qt5-feedback mailing list