I am in the process of developing an application which will have a "model tree" that helps users navigate around the data (model) and do their task. My rendering of "my model tree" since the image didn't upload:
|--Collection1
| |--c1-1, etc.
|
|--Collection2
| |--c2-1, etc.
|
I have wired context sensitive menus to the model tree, albeit clunky, they seem to work. FYI, there are disparate data structures at different levels in the tree, but usually small in size. Except at the leaf node, where they can be large, like a long table with 100k rows and 3-6 columns. I have gone through most MVD (model/view/delegate) examples, worked out a few myself (helps a lot!).
I derive from QStandardItemModel / QTreeView for the model/view aspect of "my model tree". For my prototype I have assumed QString for each item so that I can use
to create and display "my model tree". Now my 2-part question:Qt Code:
model->data(Qt::DisplayRole).toString()To copy to clipboard, switch view to plain text mode
1. I believe that I cannot use QStandardItemModel to represent disparate hierarchical data structures, where each node has its own data structure, not just different data. In this case I should derive from QAbstractItemModel, right?
2. Continue to use QStandardItemModel / QTreeView, or their subclasses, for "my model tree" and context menus. But for the actions triggered by the context menus, I could subclass from QAbstractItemModel in order to handle complex data structures, large tables and their views. Am I heading in the right direction?
Thanks for your comments and help.
Bookmarks