Hi, <div><br></div><div>Let's take the Simple Tree Model example (
<a href="http://qt-project.org/doc/qt-4.8/itemviews-simpletreemodel.html" target="_blank">http://qt-project.org/doc/qt-4.8/itemviews-simpletreemodel.html</a> ) with the TreeModel and TreeItem classes. Let's say the internal data structure looks like this:</div>


<div><br></div><div>root</div><div>|</div><div>+ Category1</div><div>|------ Item</div><div>|------ Item </div><div>|------ Item </div><div>|</div><div><div>+ Category2</div><div>|------ Item</div><div>|------ Item </div>


<div>|------ Item </div><div>|</div><div>...</div><div><br></div><div><br></div><div>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).</div>

<div><br></div><div>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:</div>

<div><ol><li>Subclass QListView to catch the Left/Right arrow keypress</li><li>Destroy the current model in the view, creating a new model with the new desired root element</li><li>Replace the model in the view by the new one</li>

</ol><div>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?</div></div><div><br></div><div>Thanks,</div>
<div><br></div>Pierre-Étienne Messier<br><br>

</div>