Developer Documentation
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 53 of file TreeModelObjectSelection.hh.

Constructor & Destructor Documentation

◆ TreeModelObjectSelection()

TreeModelObjectSelection::TreeModelObjectSelection ( QObject *  _parent = 0)
explicit

Constructor.

Parameters
_parentparent Object

Definition at line 62 of file TreeModelObjectSelection.cc.

◆ ~TreeModelObjectSelection()

TreeModelObjectSelection::~TreeModelObjectSelection ( )

Destructor.

Definition at line 73 of file TreeModelObjectSelection.cc.

Member Function Documentation

◆ columnCount()

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

Return the number of columns.

Parameters
_parentunused
Returns
return always 2

Definition at line 82 of file TreeModelObjectSelection.cc.

◆ data()

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 97 of file TreeModelObjectSelection.cc.

◆ flags()

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 142 of file TreeModelObjectSelection.cc.

◆ getItem()

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 421 of file TreeModelObjectSelection.cc.

◆ getModelIndex() [1/2]

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 475 of file TreeModelObjectSelection.cc.

◆ getModelIndex() [2/2]

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 496 of file TreeModelObjectSelection.cc.

◆ headerData()

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 168 of file TreeModelObjectSelection.cc.

◆ index()

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 194 of file TreeModelObjectSelection.cc.

◆ isRoot()

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 596 of file TreeModelObjectSelection.cc.

◆ itemId()

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 455 of file TreeModelObjectSelection.cc.

◆ itemName()

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 438 of file TreeModelObjectSelection.cc.

◆ moveItem()

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

move the item to a new parent

Parameters
_itemthe item
_parentnew parent

Definition at line 392 of file TreeModelObjectSelection.cc.

◆ objectAdded() [1/2]

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 320 of file TreeModelObjectSelection.cc.

◆ objectAdded() [2/2]

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 330 of file TreeModelObjectSelection.cc.

◆ objectChanged()

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 261 of file TreeModelObjectSelection.cc.

◆ objectDeleted()

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 365 of file TreeModelObjectSelection.cc.

◆ parent()

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 218 of file TreeModelObjectSelection.cc.

◆ propagateDownwards()

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 545 of file TreeModelObjectSelection.cc.

◆ propagateUpwards()

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 515 of file TreeModelObjectSelection.cc.

◆ rowCount()

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 240 of file TreeModelObjectSelection.cc.

◆ setData()

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 580 of file TreeModelObjectSelection.cc.


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