Expanded field not copy when saveState

27 views
Skip to first unread message

Eelco van Vliet

unread,
Mar 19, 2015, 4:50:10 AM3/19/15
to pyqt...@googlegroups.com
Hello,
I am trying to create a dialog with the Parameter tree which is restored to its last state when the dialog is reopened.
 
It works for the value settings of the fields, however, I also would like to restore the last state of expansions of the field.
 
Unfortunately the saveState routine always copies the Expanded field as True, even if it is set to false. Is this a bug?
 
In the parametertree.py example you can already see it does not work. If you save a state, change the expansions of a tab, it won't recover to its old expansion state when you push the restore button
 
any idea how to fix this?
 
Thanks
 
Regards
Eelco

Luke Campagnola

unread,
Mar 21, 2015, 2:20:29 PM3/21/15
to pyqt...@googlegroups.com
Hi,
The expansion state of the tree is not saved. In principle this should make sense because it's a model-view architecture, and the tree expansion is a property of the view, not the model (although this separation is not always strictly enforced). 

You should be able to access and set the expansion state of each tree item manually, though: http://doc.qt.io/qt-4.8/qtreewidgetitem.html#isExpanded
Note that ParameterTree is a subclass of QTreeWidget, from which you can access the top of the item tree: http://doc.qt.io/qt-4.8/qtreewidget.html#invisibleRootItem



--
You received this message because you are subscribed to the Google Groups "pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyqtgraph+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/5b900b56-4fb0-4faa-a01f-fbc3fed39bac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages