save/restore expand-state for items in a tree view. More...
#include <pqTreeViewExpandState.h>
Inherits QObject.
Public Member Functions | |
pqTreeViewExpandState (QObject *parent=nullptr) | |
~pqTreeViewExpandState () override | |
void | save (QTreeView *treeView) |
void | restore (QTreeView *treeView) |
save/restore expand-state for items in a tree view.
pqTreeViewExpandState is a helper class that can be used to save/restore expansion state for nodes in the tree view even after the view's model has been reset or severely modified.
Example usage:
Applications often want to have a default expand state for tree views. To do that, simply call QTreeView::expand
, QTreeView::expandAll
, or QTreeView::expandToDepth
before calling restore
. pqTreeViewExpandState ensures that it doesn't not save (and hence restore) state for the tree if the tree has only 1 or less nodes when save
is called.
Definition at line 43 of file pqTreeViewExpandState.h.
pqTreeViewExpandState::pqTreeViewExpandState | ( | QObject * | parent = nullptr | ) |
|
override |
void pqTreeViewExpandState::save | ( | QTreeView * | treeView | ) |
void pqTreeViewExpandState::restore | ( | QTreeView * | treeView | ) |