Hi !
I have a tree "domain model" with a lot of different nodes.
Access to the domain model is done through QAbstractItemModel which acts more like an adapter to the domain model.
The views (tree view and table view - like an explorer) are attached through two proxy models to the adapter.
The problem is that the table view shows a lot of different data (but partially the same as the tree view) and this depends on the selected node. Unfortunately setRootIndex() which is used to select what has to be shown in the table view doesn't provide something to adjust the header of the table view (the header/data should come from the item set by setRootIndex() and not the model itself).
Providing all possible headers and filtering through a proxy (depending on the node type) is complicated for such a lot of different data/headers.
Using different Q...Models (one always attached for the tree and one dynamically attached to the selected node) attached to the domain model would imply that I have to do the synchronisation by my self (That's not what I want, when Qt provides this already)
It looks like a sub-model (table) within the model (tree).
So what's the best solution for that problem ?
Example:
tree view
----------
node1
...+--- node11
...+--- node12
.............+--- node 121
....
table view node1 selected:
=================
name | h1 | h2 | h3 | h4
-------------------------------
node11 | x1 | x2 | x3 | x4
node12 | y1 | y2 | y3 | y4
table view node 121 selected:
==================
name | h1 | h7
--------------------------------
node121 | a1 | a7
.... (lets assume 30 different nodes types, and a lot of different columns)
many thanks for your help,
bernd
Note: mixing up the tree content with the table content looks like a little bit of violation of "separation of concernce" to me. nevertheless - it's legacy code and can't be changed.
Bookmarks