I am trying to figure out if it is possible to hide certain parents in a QTreeView (or TreeWidget, possibly) without hiding the children. For example:
Cars
|_Toyota
| |_Camry
| |_Corolla
|
|_Nissan
|_Altima
|_Pathfinder
|_Versa
Cars
|_Toyota
| |_Camry
| |_Corolla
|
|_Nissan
|_Altima
|_Pathfinder
|_Versa
To copy to clipboard, switch view to plain text mode
Is it possible to hide items in such a way that all that is show is:
Camry
Corolla
Altima
Pathfinder
Versa
Camry
Corolla
Altima
Pathfinder
Versa
To copy to clipboard, switch view to plain text mode
This is a simplified example to illustrate. Effectively the functionality that I'm trying to achieve is as follows:
A "parent" item represents a class of object, and all of it's child objects share certain traits and vary on certain traits (in the car example, they might all have the same engine-type and location of manufacture, but be different sizes and colors). For someone creating this [editable table] I would like to be able have the parent there to pass the overlapping traits on to their children, and have the children individually editable to fill in the traits on which they vary. However, for ease of manually copying and pasting large swaths of data into the treeview from external spreadsheets that only contain information on the children, I would like to have the parents (e.g., Toyota, Nissan) disappear. The best way to describe it would be turning the TreeView with parents and children into a TableView with only the lowest level children. What is the best approach? I'd like to toggle between the two views easily, which is why my initial idea was to simply maniuplate the TreeView. But I am definitely open to other ideas. I have read http://www.qtcentre.org/threads/4689...n-in-QTreeView and http://www.qtcentre.org/threads/2983...w-its-children . The first one doesn't work for me since there are multiple parents to hide, and the second one went unanswered. Any and all thoughts welcome! I can also explain what I'm looking for in more detail if it's not clear from what I already wrote, just let me know if you need more info.
Edit:
Would I be best served to apply a Proxy Model of some sort? I have had a hard time understanding how to use proxy models or what they do, so I'm not sure if that would be the appropriate application here...
Bookmarks