[Qt-interest] About creating a QAbstractItemModel based on an QDomDocument

David Narvaez david.e.narvaez at gmail.com
Mon Nov 9 08:25:21 CET 2009


Hi everyone,

I'm having the following problem: I'm trying to create a QAbstractItemModel
based on an XML Document stored as a QDomDocument. The problem I have with
the indexes is that it seems like I cannot trust the memory locations to use
them as internal pointers inside the QModelIndex. Here's an example from a
debugging session:

(gdb) print &this->xmlDocument->firstChild()
$5 = (QDomNode *) 0xbfba1adc
...
(gdb) print &this->xmlDocument->firstChild()
$8 = (QDomNode *) 0xbfba1b0c

No instruction between those calls modified the xmlDocument as far as I know
(those two prints were actually just before the return of a function and
just after it returned). Is that behavior normal? If so, what should I be
using as an internal ponter for the QModelIndex?

Thanks for the help.

David E. Narvaez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091109/2be72bdd/attachment.html 


More information about the Qt-interest-old mailing list