Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Relationship between a QTreeView and QAbstractItemModel
kevina67 last edited by
I am currently working on a software with a multi-document interface. On on side there is a QTabWidget and on the other side there is a QTreeView. When I click on a tab, it shows the related QAbstractItemModel in the QTreeView. Everything is logical so far. The user can expand or collapse some items in the QTreeView. The problem is : when the user, let's say, expand an item in the QTreeView, then change current tab to another one (another QAbstractItemModel will then be loaded in the QTreeView), and finally go back to the first tab, all the modifications done in the QTreeView will be lost. Is there any way to save those "changes" done in the view in any Qt class. I've searched through the net but still haven't see any related topic.
I hope my question is clearly explained enough.
Thanks in advance,
giesbert last edited by
AFAIK you have to do it on your own. The selections can be stored via an own QSelectionModel, but expanded items etc must be don on your own.