Developer Documentation

Signals | Public Member Functions | List of all members
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)
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...

## Detailed Description

Definition at line 53 of file TreeModelObjectSelection.hh.

## Constructor & Destructor Documentation

## ◆ TreeModelObjectSelection()

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

Constructor.

Parameters

  _parent | parent 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

  _parent | unused

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

  index | a ModelIndex that defines the item in the tree
  role | defines 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

  index | ModelIndex 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

  index | a 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

  _object | an object
  _column | a 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

  _id | an object id
  _column | a 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

  section | the column in the header
  orientation | header orientation (only horizontal handled)
  role | the 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

  row | the row
  column | the column
  _parent | parent 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

  _item | the 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

  index | a 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

  index | a 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

  _item | the item
  _parent | new 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

  _object | The 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

  _object | The added object
  _parent | The 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

  _id | id 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

  _id | id 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

  index | a 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

  _item | item to start with
  _column | column

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

  _item | Item to start with
  _column | The column
  _value | The 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

  _parent | parent 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

  index | a ModelIndex defining the position in the model
  value | the new value
  role | unused

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:

- OpenFlipper/publicWidgets/objectSelectionWidget/TreeModelObjectSelection.hh
- OpenFlipper/publicWidgets/objectSelectionWidget/TreeModelObjectSelection.cc