Model - view problem
-
I create a file browser with additional functions and data.
I implemented an own hierarchical model derived from QAbstractItemModel for my data structure.
I want to display hierarchical data (files and directories) two ways;- with a tree view, like this:
plants
---rose
---fruits
------grape
------apple
------pear
animals
---dog- with a table view (nodes have columns), like this (only files):
plants/rose
plants/fruits/grape
plants/fruits/apple
plants/fruits/pear
animals/dogMy problem is QTableView can display data directly under a specified node (QModelIndex), on one level.
I can set the root node (QModelIndex) with setRootIndex(), but I want to
display all hierarchical data (except directories), as shown.Creating a model is useful, because I want to edit data, too, using the different widgets.
What is the correct way to solve this problem? Creating an own view derived from QTableView?
Thanks.