I set up a QSqlRelationalTableModel for a QTreeView using a QSqlRelation to associate a key in two different tables.
I expected the QTreeView to show a parent/child relationship (a tree) based on the QSqlRelation, but it looks flat like the QTableView. Is this the expected behavior?
I wanted something that would expand when I clicked on the parent to show child records. For example, I have a "clubs" table with team names, and a different table "dogs" that are associated with an id. I hoped the QTreeView would show only field(s) from the club table until a row was clicked to "drill down" to display the associated records from the dogs table.
Do I need to do a custom model for this? Is there any point in doing a model/view approach instead of the simpler QTreeWidget, if I have to do a custom model anyway?
Thanks,
Dave Thomas
Bookmarks