[Qt5-feedback] Add internalVariant to QModelIndex
Konstantin Ritt
ritt.ks at gmail.com
Tue Jul 12 16:48:50 CEST 2011
just to be sure - are we talking about QModelIndex::internalPointer()?
having different internalPointer values in QModelIndex instances referencing
the same item sounds abnormal to me. how do you know mi1 == mi2 then?
Konstantin
2011/7/12 Matthias Hörmann <hoermann at saltation.de>
> On Tuesday 12 July 2011 13:16:10 ext Nils Jeisecke wrote:
> > Currently you can only store either a pointer or a 64bit integer
> > inside a QModelIndex.
> >
> > Depending on the data the model is wrapping it can sometimes be quite
> > hard to store all required information in one of those elements.
>
> On Tue Jul 12 13:39:56 CEST 2011 Thiago Macieira wrote
>
> > What can't you store with a pointer?
>
> On Tue Jul 12 14:48:03 CEST 2011 Christoph Feck wrote
>
> > Can you give us a use case?
>
> The current problem with the design is the fact that there is some
> kind of ASSERT in the code
> that prevents you from using different pointer values in QModelIndex
> instances referencing the
> same item. This means you have to keep your instances around and can
> not generate them
> dynamically.
>
> In one of our projects (an XML editor) we had this problem with a view
> that was supposed to display all
> possible cursor positions (before first child, between children, after
> last child, in string,...). This tree is
> very similar to the tree of all elements but not quite identical
> (there are more cursor positions than elements).
>
> QModelIndex' current design forced us to generate a permanent tree of
> all possible cursor positions just
> for the void* in QModelIndex as dynamically generated objects with the
> same informational content were
> rejected by the ASSERTS mentioned above (using two different pointers
> pointing to two instances.
>
> Of course the optimum here would be a nice type-safe API based on
> templates but naturally that would
> lead to problems with all the classes using QModelIndex. The current
> state of the API is about as bad
> as it gets for passing opaque information though other than having no
> member reserved for that at all.
>
>
> --
> Mit freundlichen Grüßen,
>
> Matthias Hörmann
>
> fon: +49 (0) 521 - 329647-21
> fax: +49 (0) 521 - 329647-40
> email: mhoermann at saltation.de
>
>
> ---------------
> saltation GmbH & Co. KG | Niederwall 43 | 33602 Bielefeld
> Sitz Bielefeld | Amtsgericht Bielefeld HRA 15344
> Persönlich haftende Gesellschafterin:
> saltation Beteiligungs-GmbH | Niederwall 43 | 33602 Bielefeld
> Sitz Bielefeld | Amtsgericht Bielefeld HRB 39339
> Geschäftsführer: Daniel Brün
> ---------------
> _______________________________________________
> 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/20110712/138cf22a/attachment.html
More information about the Qt5-feedback
mailing list