[Qt5-feedback] QAIM::headerData()

Kishore Jonnalagadda kitts.mailinglists at gmail.com
Tue Jul 26 13:59:19 CEST 2011


On Jul 26, 2011 12:27 PM, "Andre Somers" <andre at familiesomers.nl> wrote:
>
> 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 fully agree with your point of view that QAIM is perhaps overly complex.
While I fully support simplification on the whole, the current QAIM api is
at least here to stay for the qt5 lifetime. Currently, headerData() limits
the flexibility that already exists elsewhere. A small compatible change can
change that.

> 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> wrote:
>> > On Jul 20, 2011 5:38 PM, "Kishore Jonnalagadda" <
>> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt5-feedback/attachments/20110726/43d582e5/attachment.html 


More information about the Qt5-feedback mailing list