VPTissue Reference Manual
SimShell::Gui::PTreeModel Class Reference

Qt model reflecting hierarchical structure of a ptree. More...

#include <PTreeModel.h>

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

Classes

class  EditDataCommand
 Undo command that represents a single edit operation for a data value of PTreeModel. More...
 
class  EditKeyCommand
 Undo command that represents a single edit operation for a key value of PTreeModel. More...
 
class  InsertRowsCommand
 Undo command that represents a single insertion operation of rows into a PTreeModel. More...
 
class  MoveRowsCommand
 Undo command that represents a single move operation of rows inside a PTreeModel. More...
 
class  RemoveRowsCommand
 Undo command that represents a single removal operation of rows from a PTreeModel. More...
 

Public Member Functions

 PTreeModel (boost::property_tree::ptree const &tree, QObject *parent=0)
 Constructs an empty PTreeModel.
 
 PTreeModel (PTreeModel const &)=delete
 
virtual ~PTreeModel ()
 Virtual destructor.
 
virtual int columnCount (QModelIndex const &parent=QModelIndex()) const
 
virtual QVariant data (QModelIndex const &index, int role=Qt::DisplayRole) const
 
virtual bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, QModelIndex const &parent)
 
virtual Qt::ItemFlags flags (QModelIndex const &index) const
 
virtual QVariant headerData (int section, Qt::Orientation, int role) const
 
virtual QModelIndex index (int row, int column, QModelIndex const &parent=QModelIndex()) const
 
virtual bool insertRow (int row, QModelIndex const &parent=QModelIndex())
 
virtual bool insertRows (int row, int count, QModelIndex const &parent=QModelIndex())
 
bool IsOnlyEditData () const
 Test whether the "only edit data" option set. More...
 
virtual QMimeData * mimeData (QModelIndexList const &indexes) const
 
virtual QStringList mimeTypes () const
 
bool MoveRow (int old_row, QModelIndex const &old_parent, int new_row, QModelIndex const &new_parent)
 Moves a single row from one place to another. More...
 
bool MoveRows (int old_row, QModelIndex const &old_parent, int new_row, QModelIndex const &new_parent, int count)
 Moves a block of contagious rows from one place to another. More...
 
PTreeModeloperator= (PTreeModel const &)
 
virtual QModelIndex parent (QModelIndex const &index) const
 
virtual bool removeRow (int row, QModelIndex const &parent=QModelIndex())
 
virtual bool removeRows (int row, int count, QModelIndex const &parent=QModelIndex())
 
virtual int rowCount (QModelIndex const &parent=QModelIndex()) const
 
virtual bool setData (QModelIndex const &index, QVariant const &value, int role=Qt::EditRole)
 
void SetOnlyEditData (bool)
 Set the "only edit values" option. More...
 
void SetUndoStack (QUndoStack *)
 Set this model to use a given undo stack. More...
 
boost::property_tree::ptree Store () const
 Creates a new property tree from the current model state.
 
virtual Qt::DropActions supportedDragActions () const
 
virtual Qt::DropActions supportedDropActions () const
 

Detailed Description

Qt model reflecting hierarchical structure of a ptree.

To be used with PTreeView.

See also
PTreeView

Definition at line 37 of file PTreeModel.h.

Member Function Documentation

bool SimShell::Gui::PTreeModel::IsOnlyEditData ( ) const

Test whether the "only edit data" option set.

"Only edit data" means the user cannot modify key names, delete, add, move subtrees. Default = false

Definition at line 221 of file PTreeModel.cpp.

bool SimShell::Gui::PTreeModel::MoveRow ( int  old_row,
QModelIndex const &  old_parent,
int  new_row,
QModelIndex const &  new_parent 
)

Moves a single row from one place to another.

Parameters
old_rowIndex of row to move.
old_parentModel index of parent of row to move.
new_rowNew index for row.
new_parentNew parent for row.
Returns
true if successful.

Definition at line 245 of file PTreeModel.cpp.

References MoveRows().

Here is the call graph for this function:

bool SimShell::Gui::PTreeModel::MoveRows ( int  old_row,
QModelIndex const &  old_parent,
int  new_row,
QModelIndex const &  new_parent,
int  count 
)

Moves a block of contagious rows from one place to another.

Parameters
old_rowIndex of first row to move.
old_parentModel index of parent of row to move.
new_rowNew index for first row.
new_parentNew parent for row.
countNumber of rows to move.
Returns
true if successful.

Definition at line 250 of file PTreeModel.cpp.

Referenced by MoveRow().

Here is the caller graph for this function:

void SimShell::Gui::PTreeModel::SetOnlyEditData ( bool  b)

Set the "only edit values" option.

See also
IsOnlyEditValues()

Definition at line 389 of file PTreeModel.cpp.

Referenced by SimShell::Gui::PTreeEditorWindow::OpenPath(), SimShell::Gui::PTreeEditorWindow::OpenPTree(), and SimShell::Gui::PTreeEditorWindow::SetOnlyEditData().

Here is the caller graph for this function:

void SimShell::Gui::PTreeModel::SetUndoStack ( QUndoStack *  s)

Set this model to use a given undo stack.

All actions that change the model (e.g. insertRow(), setData()) will be pushed onto that stack.

Before using this model, it is necessary to call this method!

Definition at line 394 of file PTreeModel.cpp.


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