[Qt5-feedback] Add internalVariant to QModelIndex

Nils Jeisecke njeisecke at saltation.de
Tue Jul 12 14:32:22 CEST 2011


Hi,

On Tue, Jul 12, 2011 at 1:29 PM, Harald Fernengel
<harald.fernengel at nokia.com> wrote:
> The QModelIndex is volatile and short-lived

Isn't a QModelIndex stored as part of e.g. QPersistentModelIndex or
the itemview's private data (QTreeViewItem)? So it is not necessarily
short-lived at all.

> so you can let it point to a
> QVariant that is stored in your internal data structure.

If the API that I must wrap allows me to do this, fine. If not, I'm
forced to pretty much duplicate an existing model with objects that
internalPointer can point to.

> That would require a non-trivial constructor, copy constructor and destructor
> for QModelIndex, which we tried to prevent for performance reasons.

This was a good reason six years ago, but you're selling Qml to people now ;-)

However I can understand your objections.

Nils


More information about the Qt5-feedback mailing list