[Qt-interest] QModelIndex problems to represent a given data structure

Scott Aron Bloom Scott.Bloom at onshorecs.com
Mon Jul 5 23:04:59 CEST 2010



-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Andre Somers
Sent: Monday, July 05, 2010 1:21 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] QModelIndex problems to represent a given data structure

Op 5-7-2010 21:37, Justus Best schreef:
>    Hi Andre,
>
> Thanks for your help, was hoping for an "better" solution then bit
> shifting and masking my id to get all the infos I need to determine my
> elements.
> I guess its a good thing that the id is an unsigned int, caus I don't
> have to worry about algebraic  sign, but it would be even better if I
> would get all the 64bits for my id. Maybe Thiago can give a Statement to
> this if he has some time to spare ;P.
>
> Kind  regards
> Justus
>    
It gets worse. You only get 32 bits, not 64. Sorry to disapoint you, but 
QAbstractItemModel::createIndex only takes a 32 bits int (quint32, to be 
exact).

André
_______________________________________________

What I have done in the past, in order to get 64 bits, simply use Model::createIndex( r,c, void*) using a reinterpret_cast< void * >( data ) on your 64 bit data.

Then you simply use internalId to get the value back.  The data is stored as a void * internally...

Scott







More information about the Qt-interest-old mailing list