Hi,

Nice discussion!

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On
> Behalf Of ext Christoph Feck
> Sent: Tuesday, July 12, 2011 2:48 PM
> To: [email protected]
> Cc: Nils Jeisecke
> Subject: Re: [Qt5-feedback] Add internalVariant to QModelIndex
> 
> On Tuesday 12 July 2011 13:16:10 Nils Jeisecke wrote:
> > Hi!
> >
> > 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.
> 
> Can you give us a use case?

One of my first experiences with QAbstractItemModel was writing a 
'AggregateItemModel', which was basically representing several other 
QAbstractItemModels as child nodes of a common root node. Think about a tree 
with 'Locations' as root node, and several QFileSystemModel's as child nodes. 

What I actually wanted to store in each QModelIndex of the aggregating model 
was just the QModelIndex of the aggregated model. I couldn't do this however 
directly in the QModelIndex, which is why I - like others - had to resort to a 
cache in the aggregating model - an ugly and error-prone way IMO.

> > What do you think, would it be reasonable to add something like
> > internalVariant to QModelIndex?

With this I could have stored the QModelIndex of the aggregated model in the 
QModelIndex of the aggregating model, right?

Just wanted to share my use case ...

Kai

_______________________________________________
Qt5-feedback mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt5-feedback

Reply via email to