Developer Documentation
|
Signals | |
void | dataChangedInside (int _id, int _column, const QVariant &_value) |
void | moveBaseObject (int _id, int _newParentId) |
void | dataChangedInside (int _id, int _column, const QVariant &_value) |
Public Member Functions | |
TreeModel (QObject *_parent=0) | |
Constructor. More... | |
~TreeModel () | |
Destructor. More... | |
TreeModel (QObject *_parent=0) | |
Constructor. | |
~TreeModel () | |
Destructor. | |
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... | |
QVariant | data (const QModelIndex &_index, int _role) const |
Get the data of the corresponding entry. | |
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 | |
QModelIndex | index (int _row, int _column, const QModelIndex &_parent=QModelIndex()) const |
Get the ModelIndex at given row,column. | |
QModelIndex | parent (const QModelIndex &_index) const |
Get the parent ModelIndex. | |
int | rowCount (const QModelIndex &_parent=QModelIndex()) const |
get the number of rows | |
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... | |
Drag and Drop | |
Qt::DropActions | supportedDropActions () const |
supported drag & Drop actions More... | |
QStringList | mimeTypes () const |
stores the mimeType for Drag & Drop More... | |
QMimeData * | mimeData (const QModelIndexList &indexes) const |
get the mimeData for a given ModelIndex More... | |
bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) |
This is called when mimeData is dropped. More... | |
Internal DataStructure (the TreeItem Tree) | |
TreeItem * | rootItem_ |
Root item of the tree. More... | |
QModelIndex | getModelIndex (TreeItem *_object, int _column) |
Return the ModelIndex corresponding to a given TreeItem and Column. More... | |
bool | isRoot (TreeItem *_item) |
Check if the given item is the root item. More... | |
bool | getObjectName (TreeItem *_object, QString &_name) |
Get the name of a given object. | |
TreeItem * | getItem (const QModelIndex &_index) const |
Get the TreeItem corresponding to a given ModelIndex. More... | |
TreeItem * | getItem (const int _id) const |
Get the TreeItem corresponding to a given OpenFlipper ObjectID. | |
QString | itemName (const QModelIndex &_index) const |
Get the name of a TreeItem corresponding to a given ModelIndex. More... | |
int | itemId (const QModelIndex &_index) const |
Get the id of a TreeItem 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 | objectDeleted (int _id) |
The object with the given id has been deleted. delete it from the internal tree. More... | |
void | moveItem (TreeItem *_item, TreeItem *_parent) |
move the item to a new parent More... | |
QModelIndex | getModelIndex (TreeItem *_object, int _column) |
Return the ModelIndex corresponding to a given TreeItem and Column. | |
QModelIndex | getModelIndex (int _id, int _column) |
Return the ModelIndex corresponding to a given object id and Column. More... | |
bool | isRoot (TreeItem *_item) |
Check if the given item is the root item. | |
bool | getObjectName (TreeItem *_object, QString &_name) |
Get the name of a given object. | |
TreeItem * | getItem (const QModelIndex &_index) const |
Get the TreeItem corresponding to a given ModelIndex. | |
QString | itemName (const QModelIndex &_index) const |
Get the name of a TreeItem corresponding to a given ModelIndex. | |
int | itemId (const QModelIndex &_index) const |
Get the id of a TreeItem corresponding to a given ModelIndex. | |
void | objectChanged (int id_) |
The object with the given id has been changed. Check if model also has to be changed. | |
void | objectAdded (BaseObject *_object) |
The object with the given id has been added. add it to the internal tree. | |
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. | |
void | moveItem (TreeItem *_item, TreeItem *_parent) |
move the item to a new parent | |
void | propagateUpwards (TreeItem *_obj, int _column, bool _value) |
Recursively update a column up to the root of the tree. More... | |
void | propagateDownwards (TreeItem *_obj, int _column) |
Recursively update a column up to the root of the tree. More... | |
Definition at line 59 of file TreeModel.hh.
TreeModel::TreeModel | ( | QObject * | _parent = 0 | ) |
TreeModel::~TreeModel | ( | ) |
Destructor.
Definition at line 82 of file TreeModel.cc.
int TreeModel::columnCount | ( | const QModelIndex & | _parent = QModelIndex() | ) | const |
Return the number of columns.
_parent | unused |
int TreeModel::columnCount | ( | const QModelIndex & | _parent = QModelIndex() | ) | const |
Return the number of columns.
_parent | unused |
Definition at line 90 of file TreeModel.cc.
QVariant TreeModel::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 TreeModel.cc.
bool TreeModel::dropMimeData | ( | const QMimeData * | data, |
Qt::DropAction | action, | ||
int | row, | ||
int | column, | ||
const QModelIndex & | parent | ||
) |
This is called when mimeData is dropped.
data | The dropped data |
action | The definition of the dropAction which occurred |
row | Unused |
column | Unused |
parent | Parent under which the drop occurred |
Definition at line 669 of file TreeModel.cc.
Qt::ItemFlags TreeModel::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 231 of file TreeModel.cc.
TreeItem * TreeModel::getItem | ( | const QModelIndex & | _index | ) | const |
Get the TreeItem corresponding to a given ModelIndex.
Return item at given index.
_index | a ModelIndex |
Definition at line 518 of file TreeModel.cc.
QModelIndex TreeModel::getModelIndex | ( | TreeItem * | _object, |
int | _column | ||
) |
Return the ModelIndex corresponding to a given TreeItem 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 572 of file TreeModel.cc.
QModelIndex TreeModel::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 503 of file TreeModel.cc.
QVariant TreeModel::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 268 of file TreeModel.cc.
QModelIndex TreeModel::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 295 of file TreeModel.cc.
bool TreeModel::isRoot | ( | TreeItem * | _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 602 of file TreeModel.cc.
int TreeModel::itemId | ( | const QModelIndex & | _index | ) | const |
Get the id of a TreeItem corresponding to a given ModelIndex.
Return item-id at given index.
_index | a ModelIndex |
Definition at line 552 of file TreeModel.cc.
QString TreeModel::itemName | ( | const QModelIndex & | _index | ) | const |
Get the name of a TreeItem corresponding to a given ModelIndex.
Return item-name at given index.
_index | A ModelIndex |
_index | a ModelIndex |
Definition at line 535 of file TreeModel.cc.
QMimeData * TreeModel::mimeData | ( | const QModelIndexList & | _indexes | ) | const |
get the mimeData for a given ModelIndex
generate mimeData for given ModelIndexes
_indexes | list of ModelIndexes |
Definition at line 641 of file TreeModel.cc.
QStringList TreeModel::mimeTypes | ( | ) | const |
stores the mimeType for Drag & Drop
return the mimeType for drag & drop
Definition at line 626 of file TreeModel.cc.
move the item to a new parent
_item | the item |
_parent | new parent |
Definition at line 498 of file TreeModel.cc.
void TreeModel::objectAdded | ( | BaseObject * | _object | ) |
The object with the given id has been added. add it to the internal tree.
_object | The added object |
Definition at line 436 of file TreeModel.cc.
void TreeModel::objectAdded | ( | BaseObject * | _object, |
BaseObject * | _parent | ||
) |
The object with the given id has been added. add it to the internal tree.
_object | The added object |
_parent | The new parent object |
Definition at line 337 of file TreeModel.cc.
void TreeModel::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 363 of file TreeModel.cc.
void TreeModel::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 471 of file TreeModel.cc.
QModelIndex TreeModel::parent | ( | const QModelIndex & | _index | ) | const |
Get the parent ModelIndex.
Return index of parent item.
_index | a ModelIndex |
Definition at line 322 of file TreeModel.cc.
|
private |
Recursively update a column up to the root of the tree.
_item | item to start with |
_column | column which needs the update (1: visibility) |
Definition at line 552 of file TreeModel.cc.
|
private |
Recursively update a column up to the root of the tree.
_item | item to start with |
_column | column which needs the update (1: visibility) |
_value | value which will be assigned |
Definition at line 522 of file TreeModel.cc.
int TreeModel::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 344 of file TreeModel.cc.
bool TreeModel::setData | ( | const QModelIndex & | _index, |
const QVariant & | _value, | ||
int | _role | ||
) |
Set Data at 'index' to 'value'.
_index | a ModelIndex defining the positin in the model |
_value | the new value |
_role | unused |
bool TreeModel::setData | ( | const QModelIndex & | _index, |
const QVariant & | _value, | ||
int | _role | ||
) |
Set Data at 'index' to 'value'.
_index | a ModelIndex defining the positin in the model |
_value | the new value |
_role | unused |
Definition at line 585 of file TreeModel.cc.
Qt::DropActions TreeModel::supportedDropActions | ( | ) | const |
supported drag & Drop actions
return the supported drop actions
Definition at line 614 of file TreeModel.cc.
|
private |