VPTissue Reference Manual
SimShell::Gui::CheckableTreeModel Class Reference

A hierarchical tree-like model of checkable items. More...

#include <CheckableTreeModel.h>

Inheritance diagram for SimShell::Gui::CheckableTreeModel:
Inheritance graph
Collaboration diagram for SimShell::Gui::CheckableTreeModel:
Collaboration graph

Public Member Functions

 CheckableTreeModel (const boost::property_tree::ptree &tree, QObject *parent=nullptr)
 Create model. More...
 
virtual int columnCount (QModelIndex const &) const
 
virtual QVariant data (const QModelIndex &index, int role) const
 
virtual Qt::ItemFlags flags (const QModelIndex &index) const
 
virtual QVariant headerData (int section, Qt::Orientation o, int role) const
 
virtual QModelIndex index (int row, int column, QModelIndex const &parent) const
 
virtual QModelIndex parent (QModelIndex const &index) const
 
virtual int rowCount (QModelIndex const &parent) const
 
virtual bool setData (QModelIndex const &index, const QVariant &value, int role)
 
boost::property_tree::ptree ToPTree ()
 Get checked/unchecked state of items, represented by a ptree of the form discussed in the constructor. More...
 

Detailed Description

A hierarchical tree-like model of checkable items.

After construction, the structure remains fixed; The only part of state that can be modified by the user is the checked/unchecked state of items.

Definition at line 33 of file CheckableTreeModel.h.

Constructor & Destructor Documentation

SimShell::Gui::CheckableTreeModel::CheckableTreeModel ( const boost::property_tree::ptree &  tree,
QObject parent = nullptr 
)

Create model.

The items are constructed from a ptree with the following structure:

<some_item0>
<checked>false</checked>
<children>
<some_item1>
<checked>true</checked>
</some_item1>
</children>
</some_item0>
<some_item2>
<checked>true</checked>
<children/>
</some_other_item2>

The <checked> node must be present for every item, the <children> node is optional.

At a later moment, the checked/unchecked state of items can be retrieved by the method ToPTree(). The returned ptree will have the same structure, only the (boolean) values in the <checked> nodes may differ.

Parameters
treeA Ptree of form discussed above.
parentQt parent object that will take ownership of this object.
See also
ToPTree()
Exceptions
ptree_bad_pathif malformed ptree.
ptree_bad_dataif malformed ptree.

Definition at line 35 of file CheckableTreeModel.cpp.

References parent().

Here is the call graph for this function:

Member Function Documentation

int SimShell::Gui::CheckableTreeModel::columnCount ( QModelIndex const &  ) const
virtual
See also
QAbstractItemModel

Definition at line 81 of file CheckableTreeModel.cpp.

QVariant SimShell::Gui::CheckableTreeModel::data ( const QModelIndex &  index,
int  role 
) const
virtual
See also
QAbstractItemModel

Definition at line 85 of file CheckableTreeModel.cpp.

Qt::ItemFlags SimShell::Gui::CheckableTreeModel::flags ( const QModelIndex &  index) const
virtual
See also
QAbstractItemModel

Definition at line 104 of file CheckableTreeModel.cpp.

QVariant SimShell::Gui::CheckableTreeModel::headerData ( int  section,
Qt::Orientation  o,
int  role 
) const
virtual
See also
QAbstractItemModel

Definition at line 113 of file CheckableTreeModel.cpp.

QModelIndex SimShell::Gui::CheckableTreeModel::index ( int  row,
int  column,
QModelIndex const &  parent 
) const
virtual
See also
QAbstractItemModel

Definition at line 118 of file CheckableTreeModel.cpp.

QModelIndex SimShell::Gui::CheckableTreeModel::parent ( QModelIndex const &  index) const
virtual
See also
QAbstractItemModel

Definition at line 134 of file CheckableTreeModel.cpp.

Referenced by CheckableTreeModel().

Here is the caller graph for this function:

int SimShell::Gui::CheckableTreeModel::rowCount ( QModelIndex const &  parent) const
virtual
See also
QAbstractItemModel

Definition at line 151 of file CheckableTreeModel.cpp.

bool SimShell::Gui::CheckableTreeModel::setData ( QModelIndex const &  index,
const QVariant &  value,
int  role 
)
virtual
See also
QAbstractItemModel

Definition at line 162 of file CheckableTreeModel.cpp.

ptree SimShell::Gui::CheckableTreeModel::ToPTree ( )

Get checked/unchecked state of items, represented by a ptree of the form discussed in the constructor.

See also
CheckableTreeModel()

Definition at line 66 of file CheckableTreeModel.cpp.

Referenced by SimShell::Gui::SaveChangesDialog::Prompt().

Here is the caller graph for this function:


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