50 #ifndef TREEMODELOBJECTSELECTION_H 51 #define TREEMODELOBJECTSELECTION_H 53 #include <QAbstractItemModel> 54 #include <QModelIndex> 57 #include "TreeItemObjectSelection.hh" 65 void dataChangedInside(
int _id,
int _column,
const QVariant& _value);
83 QVariant
data(
const QModelIndex &
index,
int role)
const;
86 Qt::ItemFlags
flags(
const QModelIndex &index)
const;
90 Qt::Orientation orientation,
91 int role = Qt::DisplayRole)
const;
94 QModelIndex
index(
int row,
int column,
95 const QModelIndex &
parent = QModelIndex())
const;
98 QModelIndex
parent(
const QModelIndex &index)
const;
101 int rowCount(
const QModelIndex &parent = QModelIndex())
const;
108 int columnCount(
const QModelIndex &_parent = QModelIndex())
const;
117 bool setData(
const QModelIndex &index,
const QVariant &value ,
int role);
144 QString
itemName(
const QModelIndex &index)
const;
147 int itemId(
const QModelIndex &index)
const;
int columnCount(const QModelIndex &_parent=QModelIndex()) const
Return the number of columns.
QModelIndex parent(const QModelIndex &index) const
Get the parent ModelIndex.
TreeItemObjectSelection * getItem(const QModelIndex &index) const
Get the TreeItemObjectSelection corresponding to a given ModelIndex.
Qt::ItemFlags flags(const QModelIndex &index) const
return the types of the corresponding entry
int rowCount(const QModelIndex &parent=QModelIndex()) const
get the number of rows
void objectAdded(BaseObject *_object)
The object with the given id has been added. add it to the internal tree.
void propagateDownwards(TreeItemObjectSelection *_obj, int _column)
Recursively update a column up to the root of the tree.
void objectChanged(int id_)
The object with the given id has been changed. Check if model also has to be changed.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
return the header data of the model
int itemId(const QModelIndex &index) const
Get the id of a TreeItemObjectSelection corresponding to a given ModelIndex.
bool setData(const QModelIndex &index, const QVariant &value, int role)
Set Data at 'index' to 'value'.
QString itemName(const QModelIndex &index) const
Get the name of a TreeItemObjectSelection corresponding to a given ModelIndex.
void propagateUpwards(TreeItemObjectSelection *_obj, int _column, bool _value)
Recursively update a column up to the root of the tree.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Get the ModelIndex at given row,column.
TreeModelObjectSelection(QObject *_parent=0)
Constructor.
TreeItemObjectSelection * rootItem_
Rootitem of the tree.
QVariant data(const QModelIndex &index, int role) const
Get the data of the corresponding entry.
~TreeModelObjectSelection()
Destructor.
void moveItem(TreeItemObjectSelection *_item, TreeItemObjectSelection *_parent)
move the item to a new parent
void objectDeleted(int id_)
The object with the given id has been deleted. delete it from the internal tree.
bool getObjectName(TreeItemObjectSelection *_object, QString &_name)
Get the name of a given object.
QModelIndex getModelIndex(TreeItemObjectSelection *_object, int _column)
Return the ModelIndex corresponding to a given TreeItemObjectSelection and Column.
bool isRoot(TreeItemObjectSelection *_item)
Check if the given item is the root item.