53 #include <QAbstractItemModel>
54 #include <QModelIndex>
57 #include "TreeItem.hh"
65 void dataChangedInside(
int _id,
int _column,
const QVariant& _value);
67 void moveBaseObject(
int _id,
int _newParentId);
85 QVariant
data(
const QModelIndex &_index,
int _role)
const;
88 Qt::ItemFlags
flags(
const QModelIndex &_index)
const;
92 Qt::Orientation _orientation,
93 int _role = Qt::DisplayRole)
const;
96 QModelIndex
index(
int _row,
int _column,
97 const QModelIndex &_parent = QModelIndex())
const;
100 QModelIndex
parent(
const QModelIndex &_index)
const;
103 int rowCount(
const QModelIndex &_parent = QModelIndex())
const;
110 int columnCount(
const QModelIndex &_parent = QModelIndex())
const;
119 bool setData(
const QModelIndex &_index,
const QVariant &_value ,
int _role);
146 QString
itemName(
const QModelIndex &_index)
const;
149 int itemId(
const QModelIndex &_index)
const;
185 QMimeData*
mimeData(
const QModelIndexList& indexes)
const;
196 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &parent);
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
This is called when mimeData is dropped.
void objectAdded(BaseObject *_object)
The object with the given id has been added. add it to the internal tree.
QString itemName(const QModelIndex &_index) const
Get the name of a TreeItem corresponding to a given ModelIndex.
TreeModel(QObject *_parent=0)
Constructor.
QStringList mimeTypes() const
stores the mimeType for Drag & Drop
QModelIndex parent(const QModelIndex &_index) const
Get the parent ModelIndex.
bool isRoot(TreeItem *_item)
Check if the given item is the root item.
QModelIndex index(int _row, int _column, const QModelIndex &_parent=QModelIndex()) const
Get the ModelIndex at given row,column.
QVariant headerData(int _section, Qt::Orientation _orientation, int _role=Qt::DisplayRole) const
return the header data of the model
TreeItem * rootItem_
Root item of the tree.
void objectChanged(int _id)
The object with the given id has been changed. Check if model also has to be changed.
Qt::DropActions supportedDropActions() const
supported drag & Drop actions
int rowCount(const QModelIndex &_parent=QModelIndex()) const
get the number of rows
QMimeData * mimeData(const QModelIndexList &indexes) const
get the mimeData for a given ModelIndex
int itemId(const QModelIndex &_index) const
Get the id of a TreeItem corresponding to a given ModelIndex.
Qt::ItemFlags flags(const QModelIndex &_index) const
return the types of the corresponding entry
QVariant data(const QModelIndex &_index, int _role) const
Get the data of the corresponding entry.
bool setData(const QModelIndex &_index, const QVariant &_value, int _role)
Set Data at 'index' to 'value'.
bool getObjectName(TreeItem *_object, QString &_name)
Get the name of a given object.
int columnCount(const QModelIndex &_parent=QModelIndex()) const
Return the number of columns.
void objectDeleted(int _id)
The object with the given id has been deleted. delete it from the internal tree.
TreeItem * getItem(const QModelIndex &_index) const
Get the TreeItem corresponding to a given ModelIndex.
QModelIndex getModelIndex(TreeItem *_object, int _column)
Return the ModelIndex corresponding to a given TreeItem and Column.
void moveItem(TreeItem *_item, TreeItem *_parent)
move the item to a new parent