Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TreeModelObjectSelection Class Reference
Inheritance diagram for TreeModelObjectSelection:

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)

TreeItemObjectSelectionrootItem_
 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.
 
TreeItemObjectSelectiongetItem (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...
 

Detailed Description

Definition at line 59 of file TreeModelObjectSelection.hh.

Constructor & Destructor Documentation

TreeModelObjectSelection::TreeModelObjectSelection ( QObject *  _parent = 0)

Constructor.

Parameters
_parentparent Object

Definition at line 70 of file TreeModelObjectSelection.cc.

TreeModelObjectSelection::~TreeModelObjectSelection ( )

Destructor.

Definition at line 81 of file TreeModelObjectSelection.cc.

Member Function Documentation

int TreeModelObjectSelection::columnCount ( const QModelIndex &  _parent = QModelIndex()) const

Return the number of columns.

Parameters
_parentunused
Returns
return always 2

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.

Parameters
indexa ModelIndex that defines the item in the tree
roledefines the kind of data requested
Returns
requested data

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.

Parameters
indexModelIndex that defines an item in the tree
Returns
flags for the given ModelIndex

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.

Parameters
indexa ModelIndex
Returns
item at given index

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

Parameters
_objectan object
_columna column
Returns
index of object and 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

Parameters
_idan object id
_columna column
Returns
index of object and 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.

Parameters
sectionthe column in the header
orientationheader orientation (only horizontal handled)
rolethe role that defines the type of data
Returns
the requested 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.

Parameters
rowthe row
columnthe column
_parentparent item
Returns
corresponding ModelIndex

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

Parameters
_itemthe item to be checked
Returns
is it the root object?

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.

Parameters
indexa ModelIndex
Returns
item-id at given index

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.

Parameters
indexa ModelIndex
Returns
name of the item at given index

Definition at line 446 of file TreeModelObjectSelection.cc.

void TreeModelObjectSelection::moveItem ( TreeItemObjectSelection _item,
TreeItemObjectSelection _parent 
)

move the item to a new parent

Parameters
_itemthe item
_parentnew 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.

Parameters
_objectThe 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.

Parameters
_objectThe added object
_parentThe 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.

Parameters
_idid 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.

Parameters
_idid 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.

Parameters
indexa ModelIndex
Returns
parent of the given ModelIndex

Definition at line 226 of file TreeModelObjectSelection.cc.

void TreeModelObjectSelection::propagateDownwards ( TreeItemObjectSelection _item,
int  _column 
)
private

Recursively update a column up to the root of the tree.

Parameters
_itemitem to start with
_columncolumn

Definition at line 553 of file TreeModelObjectSelection.cc.

void TreeModelObjectSelection::propagateUpwards ( TreeItemObjectSelection _item,
int  _column,
bool  _value 
)
private

Recursively update a column up to the root of the tree.

Parameters
_itemItem to start with
_columnThe column
_valueThe 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.

Parameters
_parentparent Item
Returns
number of rows that are children of given parent

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'.

Parameters
indexa ModelIndex defining the position in the model
valuethe new value
roleunused
Returns
return if the data was set successfully

Definition at line 588 of file TreeModelObjectSelection.cc.


The documentation for this class was generated from the following files: