-
I noticed the method 'internalpointer()' is missing entirely from io.qt.core.QModelIndex class. Although the similar method internalId() is defined, its return type is mapped to 'long' because its return type in C++ was 'quint64'. The doc is explicit about that too. But my question is, how to achieve similar functions of 'internalId()' and 'internalPointer()' in QTJambi? Is there any way to convert the result of the defined 'internalId()' into Object? Or should it be returning Object instead? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Never mind. Found out that the internalId() does the job perfectly. My confusion was the result of my poor understanding. These functions were NOT meant to provide values themselves from somewhere somehow. Rather they they return the id value you provided for createIndex() during the creation of QModeleIndex. That value helps you to identify the node in your view in your INTERNAL data structures, which you must create yourself. My mistake lies with thinking the value is some magical pointer to node I'm looking for. In my case, I ended up creating a hashMap mapping hashCode() to object references. I supplied the hashCode() to createIndex(). When object corresponding to internalId() is required, I just lookup in hashMap. Hope this helps anyone who might have confusion. |
Beta Was this translation helpful? Give feedback.
Never mind. Found out that the internalId() does the job perfectly. My confusion was the result of my poor understanding.
These functions were NOT meant to provide values themselves from somewhere somehow. Rather they they return the id value you provided for createIndex() during the creation of QModeleIndex. That value helps you to identify the node in your view in your INTERNAL data structures, which you must create yourself. My mistake lies with thinking the value is some magical pointer to node I'm looking for.
In my case, I ended up creating a hashMap mapping hashCode() to object references. I supplied the hashCode() to createIndex(). When object corresponding to internalId() is requ…