[Interest] Tree Model and QListView
pierre.etienne.messier at gmail.com
Thu Sep 27 15:40:39 CEST 2012
Let's take the Simple Tree Model example (
http://qt-project.org/doc/qt-4.8/itemviews-simpletreemodel.html ) with the
TreeModel and TreeItem classes. Let's say the internal data structure looks
I want to display that model inside a custom QListView to only show one
Category at a time. So far, I ran a few tests and for example, setting the
root element (in the model) as Category2 will indeed show only Category2 in
the QListView (desired behavior).
I want that when navigating with the keyboard arrows left-right keys would
"reset" the model root node inside the QListView (Category1, then Category2
and so on). Would it be a good idea to:
1. Subclass QListView to catch the Left/Right arrow keypress
2. Destroy the current model in the view, creating a new model with the
new desired root element
3. Replace the model in the view by the new one
On paper, it seems quite inefficient to me. Any experience with that kind
of operation? Could I just do this all inside one model instead?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest