Developer Documentation
|
Signals | |
void | dataChangedInside (int _id, int _column, const QVariant &_value) |
Public Member Functions | |
TreeModelObjectSelection (QObject *_parent=0) | |
Constructor. More... | |
~TreeModelObjectSelection () | |
Destructor. More... | |
inherited from QAbstractItemModel | |
QVariant | data (const QModelIndex &index, int role) const |
Get the data of the corresponding entry. More... | |
Qt::ItemFlags | flags (const QModelIndex &index) const |
return the types of the corresponding entry More... | |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
return the header data of the model More... | |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const |
Get the ModelIndex at given row,column. More... | |
QModelIndex | parent (const QModelIndex &index) const |
Get the parent ModelIndex. More... | |
int | rowCount (const QModelIndex &parent=QModelIndex()) const |
get the number of rows More... | |
int | columnCount (const QModelIndex &_parent=QModelIndex()) const |
Return the number of columns. More... | |
bool | setData (const QModelIndex &index, const QVariant &value, int role) |
Set Data at 'index' to 'value'. More... | |
Internal DataStructure (the TreeItemObjectSelection Tree) | |
TreeItemObjectSelection * | rootItem_ |
Rootitem of the tree. | |
QModelIndex | getModelIndex (TreeItemObjectSelection *_object, int _column) |
Return the ModelIndex corresponding to a given TreeItemObjectSelection and Column. More... | |
QModelIndex | getModelIndex (int _id, int _column) |
Return the ModelIndex corresponding to a given object id and Column. More... | |
bool | isRoot (TreeItemObjectSelection *_item) |
Check if the given item is the root item. More... | |
bool | getObjectName (TreeItemObjectSelection *_object, QString &_name) |
Get the name of a given object. | |
TreeItemObjectSelection * | getItem (const QModelIndex &index) const |
Get the TreeItemObjectSelection corresponding to a given ModelIndex. More... | |
QString | itemName (const QModelIndex &index) const |
Get the name of a TreeItemObjectSelection corresponding to a given ModelIndex. More... | |
int | itemId (const QModelIndex &index) const |
Get the id of a TreeItemObjectSelection corresponding to a given ModelIndex. More... | |
void | objectChanged (int id_) |
The object with the given id has been changed. Check if model also has to be changed. More... | |
void | objectAdded (BaseObject *_object) |
The object with the given id has been added. add it to the internal tree. More... | |
void | objectAdded (BaseObject *_object, BaseObject *_parent) |
The object with the given id has been added. add it to the internal tree. More... | |
void | objectDeleted (int id_) |
The object with the given id has been deleted. delete it from the internal tree. More... | |
void | moveItem (TreeItemObjectSelection *_item, TreeItemObjectSelection *_parent) |
move the item to a new parent More... | |
void | propagateUpwards (TreeItemObjectSelection *_obj, int _column, bool _value) |
Recursively update a column up to the root of the tree. More... | |
void | propagateDownwards (TreeItemObjectSelection *_obj, int _column) |
Recursively update a column up to the root of the tree. More... | |
Definition at line 59 of file TreeModelObjectSelection.hh.
TreeModelObjectSelection::TreeModelObjectSelection | ( | QObject * | _parent = 0 | ) |
Constructor.
_parent | parent Object |
Definition at line 70 of file TreeModelObjectSelection.cc.
TreeModelObjectSelection::~TreeModelObjectSelection | ( | ) |
Destructor.
Definition at line 81 of file TreeModelObjectSelection.cc.
int TreeModelObjectSelection::columnCount | ( | const QModelIndex & | _parent = QModelIndex() | ) | const |
Return the number of columns.
_parent | unused |
Definition at line 90 of file TreeModelObjectSelection.cc.
QVariant TreeModelObjectSelection::data | ( | const QModelIndex & | index, |
int | role | ||
) | const |
Get the data of the corresponding entry.
Returns the data stored under the given role for the item referred to by the index.
index | a ModelIndex that defines the item in the tree |
role | defines the kind of data requested |
Definition at line 105 of file TreeModelObjectSelection.cc.
Qt::ItemFlags TreeModelObjectSelection::flags | ( | const QModelIndex & | index | ) | const |
return the types of the corresponding entry
Returns the item flags for the given index.
index | ModelIndex that defines an item in the tree |
Definition at line 150 of file TreeModelObjectSelection.cc.
TreeItemObjectSelection * TreeModelObjectSelection::getItem | ( | const QModelIndex & | index | ) | const |
Get the TreeItemObjectSelection corresponding to a given ModelIndex.
Return item at given index.
index | a ModelIndex |
Definition at line 429 of file TreeModelObjectSelection.cc.
QModelIndex TreeModelObjectSelection::getModelIndex | ( | TreeItemObjectSelection * | _object, |
int | _column | ||
) |
Return the ModelIndex corresponding to a given TreeItemObjectSelection and Column.
Return index of given item.
Warning: Only use this function if you know that all ModelIndices are created
_object | an object |
_column | a column |
Definition at line 483 of file TreeModelObjectSelection.cc.
QModelIndex TreeModelObjectSelection::getModelIndex | ( | int | _id, |
int | _column | ||
) |
Return the ModelIndex corresponding to a given object id and Column.
Return index of given item.
Warning: Only use this function if you know that all ModelIndices are created
_id | an object id |
_column | a column |
Definition at line 504 of file TreeModelObjectSelection.cc.
QVariant TreeModelObjectSelection::headerData | ( | int | section, |
Qt::Orientation | orientation, | ||
int | role = Qt::DisplayRole |
||
) | const |
return the header data of the model
Returns the data in the header.
section | the column in the header |
orientation | header orientation (only horizontal handled) |
role | the role that defines the type of data |
Definition at line 176 of file TreeModelObjectSelection.cc.
QModelIndex TreeModelObjectSelection::index | ( | int | row, |
int | column, | ||
const QModelIndex & | _parent = QModelIndex() |
||
) | const |
Get the ModelIndex at given row,column.
Returns the index of the item in the model specified by the given row, column and parent index.
row | the row |
column | the column |
_parent | parent item |
Definition at line 202 of file TreeModelObjectSelection.cc.
bool TreeModelObjectSelection::isRoot | ( | TreeItemObjectSelection * | _item | ) |
Check if the given item is the root item.
return if an object is equal to the root object
_item | the item to be checked |
Definition at line 604 of file TreeModelObjectSelection.cc.
int TreeModelObjectSelection::itemId | ( | const QModelIndex & | index | ) | const |
Get the id of a TreeItemObjectSelection corresponding to a given ModelIndex.
Return item-id at given index.
index | a ModelIndex |
Definition at line 463 of file TreeModelObjectSelection.cc.
QString TreeModelObjectSelection::itemName | ( | const QModelIndex & | index | ) | const |
Get the name of a TreeItemObjectSelection corresponding to a given ModelIndex.
Return item-name at given index.
index | a ModelIndex |
Definition at line 446 of file TreeModelObjectSelection.cc.
void TreeModelObjectSelection::moveItem | ( | TreeItemObjectSelection * | _item, |
TreeItemObjectSelection * | _parent | ||
) |
move the item to a new parent
_item | the item |
_parent | new parent |
Definition at line 400 of file TreeModelObjectSelection.cc.
void TreeModelObjectSelection::objectAdded | ( | BaseObject * | _object | ) |
The object with the given id has been added. add it to the internal tree.
The object with the given id has been added. Add it to the internal tree.
_object | The object that has been added |
Definition at line 328 of file TreeModelObjectSelection.cc.
void TreeModelObjectSelection::objectAdded | ( | BaseObject * | _object, |
BaseObject * | _parent | ||
) |
The object with the given id has been added. add it to the internal tree.
The object has been added. Add it to the internal tree.
_object | The added object |
_parent | The parent object |
Definition at line 338 of file TreeModelObjectSelection.cc.
void TreeModelObjectSelection::objectChanged | ( | int | _id | ) |
The object with the given id has been changed. Check if model also has to be changed.
The object with the given id has been changed. Update the model.
_id | id of an object |
Definition at line 269 of file TreeModelObjectSelection.cc.
void TreeModelObjectSelection::objectDeleted | ( | int | _id | ) |
The object with the given id has been deleted. delete it from the internal tree.
_id | id of the object |
Definition at line 373 of file TreeModelObjectSelection.cc.
QModelIndex TreeModelObjectSelection::parent | ( | const QModelIndex & | index | ) | const |
Get the parent ModelIndex.
Return index of parent item.
index | a ModelIndex |
Definition at line 226 of file TreeModelObjectSelection.cc.
|
private |
Recursively update a column up to the root of the tree.
_item | item to start with |
_column | column |
Definition at line 553 of file TreeModelObjectSelection.cc.
|
private |
Recursively update a column up to the root of the tree.
_item | Item to start with |
_column | The column |
_value | The value that should be propagated |
Definition at line 523 of file TreeModelObjectSelection.cc.
int TreeModelObjectSelection::rowCount | ( | const QModelIndex & | _parent = QModelIndex() | ) | const |
get the number of rows
Returns the number of rows under given parent.
_parent | parent Item |
Definition at line 248 of file TreeModelObjectSelection.cc.
bool TreeModelObjectSelection::setData | ( | const QModelIndex & | index, |
const QVariant & | value, | ||
int | role | ||
) |
Set Data at 'index' to 'value'.
index | a ModelIndex defining the position in the model |
value | the new value |
role | unused |
Definition at line 588 of file TreeModelObjectSelection.cc.