Type: User Story
Priority: P3: Somewhat important
Resolution: Out of scope
Affects Version/s: None
Fix Version/s: None
Component/s: SQL Support
Version : QT 4.7.3 (mingw) / win XP
SQL table group ( id, name )
SQL table students ( id, name, group_id )
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,