[Qt-interest] Creating a QModelIndex outside of a QAbstractItemModel subclass

Andreas Pakulat apaku at gmx.de
Thu Mar 12 11:43:45 CET 2009


On 12.03.09 09:15:25, Jesús Fernández wrote:
> Creating a QModelIndex outside of a model has no sense, because it needs a
> private pointer or a identifier for the model to allocate the data of the
> item.

No it doesn't. Its perfectly possible to do without that, wether or not
thats needed totally depends on your models implementation. For example
QStringListModel doesn't use the internalPointer/Id at all, neither should
most table-models need this. And you can even implement tree models
without, but of course they'd be somewhat slow as they'd have to traverse
the tree a lot if you don't get the parent-tree-item via the internalId or
internalPointer.

Andreas

-- 
Don't look now, but the man in the moon is laughing at you.



More information about the Qt-interest-old mailing list