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