1 #ifndef PTREEMODEL_H_INCLUDED
2 #define PTREEMODEL_H_INCLUDED
22 #include <boost/property_tree/ptree_fwd.hpp>
23 #include <QAbstractItemModel>
68 bool MoveRow(
int old_row, QModelIndex
const& old_parent,
int new_row, QModelIndex
const& new_parent);
79 bool MoveRows(
int old_row, QModelIndex
const& old_parent,
int new_row, QModelIndex
const& new_parent,
int count);
101 boost::property_tree::ptree
Store()
const;
104 virtual int columnCount(QModelIndex
const& parent = QModelIndex())
const;
105 virtual QVariant data(QModelIndex
const& index,
int role = Qt::DisplayRole)
const;
106 virtual Qt::ItemFlags flags(QModelIndex
const& index)
const;
107 virtual QVariant headerData(
int section, Qt::Orientation,
int role)
const;
108 virtual QModelIndex index(
int row,
int column, QModelIndex
const& parent = QModelIndex())
const;
109 virtual bool insertRow(
int row, QModelIndex
const& parent = QModelIndex());
110 virtual bool insertRows(
int row,
int count, QModelIndex
const& parent = QModelIndex());
111 virtual bool removeRow(
int row, QModelIndex
const& parent = QModelIndex());
112 virtual bool removeRows(
int row,
int count, QModelIndex
const& parent = QModelIndex());
113 virtual QModelIndex parent(QModelIndex
const& index)
const;
114 virtual int rowCount(QModelIndex
const& parent = QModelIndex())
const;
115 virtual bool setData(QModelIndex
const& index, QVariant
const& value,
int role = Qt::EditRole);
116 virtual Qt::DropActions supportedDragActions()
const;
117 virtual Qt::DropActions supportedDropActions()
const;
118 virtual QStringList mimeTypes()
const;
119 virtual QMimeData* mimeData(QModelIndexList
const& indexes)
const;
120 virtual bool dropMimeData(
const QMimeData* data, Qt::DropAction action,
int row,
int column, QModelIndex
const& parent);
129 Item(Item* parent = 0, QVariant
const& key = QVariant(),
int row = 0);
131 Item& operator=(Item
const&);
138 Item* GetChild(
unsigned int i);
141 Item
const* GetChild(
unsigned int i)
const;
144 int GetChildrenCount()
const;
147 Item
const* GetParent()
const;
150 void InsertChild(
unsigned int row, Item*);
156 void Load(boost::property_tree::ptree
const& t);
159 void RemoveChild(
unsigned int row);
165 boost::property_tree::ptree
Store()
const;
174 std::vector<Item*> children;
177 QUndoStack* undo_stack;
191 #endif // end_of_inclde_guard
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.
see the online Qt documentation
Undo command that represents a single edit operation for a data value of PTreeModel.
boost::property_tree::ptree Store() const
Creates a new property tree from the current model state.
PTreeModel(boost::property_tree::ptree const &tree, QObject *parent=0)
Constructs an empty PTreeModel.
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.
Undo command that represents a single move operation of rows inside a PTreeModel. ...
virtual ~PTreeModel()
Virtual destructor.
Qt model reflecting hierarchical structure of a ptree.
bool IsOnlyEditData() const
Test whether the "only edit data" option set.
Undo command that represents a single insertion operation of rows into a PTreeModel.
void SetOnlyEditData(bool)
Set the "only edit values" option.
Undo command that represents a single edit operation for a key value of PTreeModel.
see the online Qt documentation
Namespace for generic graphical shell for simulators.
Undo command that represents a single removal operation of rows from a PTreeModel.
void SetUndoStack(QUndoStack *)
Set this model to use a given undo stack.