Details
-
User Story
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
None
-
None
Description
Version : QT 4.7.3 (mingw) / win XP
Data :
SQL table group ( id, name )
SQL table students ( id, name, group_id )
Issue :
Sub - classing QSqlRelationalTableModel in order to have on a treeview :
- toplevelitems : content of group
- children of toplevelitems : content of students for a given group ( with group_id)
I use QSqlRelationalTableModel because 'name' columns are in other tables.
All is going well except for the data function redefinition.
I have the good number of toplevelitems and for each item the good number of children.
But the data within the children is only the toplevel data repeated ( data function not working )
I have found out that the modelItem.internalPointer is always NULL in data function, even if I do set it within the index redefinition via createindex(row, column, (void*)data) (I set it to the SQLModel* for each child of toplevelitems).
I can't redefine the parent for modelIndex either since the QAbstractTableModel::parent() function is private, which could have helped me to know where I was within the 'tree' model inside the data redefinition.
Is there another way to achieve what I want to do ? Is it normal that internalPointer is always NULL ?
(model class code attached )
Thank you for the help,
Sebius.