Public Member Functions | List of all members
pqTreeViewExpandState Class Reference

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)

Detailed Description

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:;
// do other changes to model.
// optional default expand state.

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 71 of file pqTreeViewExpandState.h.

Constructor & Destructor Documentation

◆ pqTreeViewExpandState()

pqTreeViewExpandState::pqTreeViewExpandState ( QObject *  parent = nullptr)

◆ ~pqTreeViewExpandState()

pqTreeViewExpandState::~pqTreeViewExpandState ( )

Member Function Documentation

◆ save()

void pqTreeViewExpandState::save ( QTreeView *  treeView)

◆ restore()

void pqTreeViewExpandState::restore ( QTreeView *  treeView)

The documentation for this class was generated from the following file: