Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-23215

internalPointer always null on a QSqlRelationalTableModel subclass using a treeview

    XMLWordPrintable

    Details

    • Type: User Story
    • Status: Withdrawn
    • Priority: P3: Somewhat important
    • Resolution: Out of scope
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: SQL Support
    • Labels:
      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.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            mabrand Mark Brand
            Reporter:
            sebius seb
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes