VPTissue Reference Manual
|
Qt model reflecting hierarchical structure of a ptree. More...
#include <PTreeModel.h>
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... | |
PTreeModel & | operator= (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 |
Qt model reflecting hierarchical structure of a ptree.
To be used with PTreeView.
Definition at line 37 of file PTreeModel.h.
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.
old_row | Index of row to move. |
old_parent | Model index of parent of row to move. |
new_row | New index for row. |
new_parent | New parent for row. |
Definition at line 245 of file PTreeModel.cpp.
References MoveRows().
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.
old_row | Index of first row to move. |
old_parent | Model index of parent of row to move. |
new_row | New index for first row. |
new_parent | New parent for row. |
count | Number of rows to move. |
Definition at line 250 of file PTreeModel.cpp.
Referenced by MoveRow().
void SimShell::Gui::PTreeModel::SetOnlyEditData | ( | bool | b | ) |
Set the "only edit values" option.
Definition at line 389 of file PTreeModel.cpp.
Referenced by SimShell::Gui::PTreeEditorWindow::OpenPath(), SimShell::Gui::PTreeEditorWindow::OpenPTree(), and SimShell::Gui::PTreeEditorWindow::SetOnlyEditData().
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.