#include <TreeItem.hxx>
Public Member Functions | |
TreeItem (const QString &nameId, const QVector< QVariant > &columnValues, TreeItem *parent=0) | |
~TreeItem () | |
QString | nameId () |
void | associateToModel (TreeModel *model) |
TreeModel * | associatedModel () |
QModelIndex | modelIndex (int column=0) |
TreeItem * | parent () |
void | appendChild (TreeItem *child) |
void | appendChild (DataObject *dataObject, const QStringList &relativePath=QStringList()) |
void | appendChild (const QString &nameId, const QVector< QVariant > &columnValues, const QStringList &relativePath=QStringList()) |
void | removeChild (TreeItem *child) |
void | removeChild (DataObject *dataObject, const QStringList &relativePath=QStringList()) |
TreeItem * | child (int row) |
TreeItem * | childById (const QString &nameId) |
TreeItem * | childByLabel (const QString &label) |
int | childCount () const |
int | columnCount () const |
int | rowIndex () const |
QVariant | data (int column) const |
bool | setData (int column, const QVariant &value) |
Private Member Functions | |
void | initialize (const QString &nameId, const QVector< QVariant > &columnValues, TreeItem *parent) |
Private Attributes | |
QList< TreeItem * > | _childItems |
QMap< QString, TreeItem * > | _childItemsMapById |
QMap< QString, TreeItem * > | _childItemsMapByLabel |
QString | _itemNameId |
QVector< QVariant > | _itemData |
TreeItem * | _parentItem |
TreeModel * | _associatedModel |
TreeItem::TreeItem | ( | const QString & | nameId, |
const QVector< QVariant > & | columnValues, | ||
TreeItem * | parent = 0 |
||
) |
References initialize().
TreeItem::~TreeItem | ( | ) |
References _childItems, _childItemsMapById, and _childItemsMapByLabel.
void TreeItem::appendChild | ( | TreeItem * | item | ) |
This appends the specified child to this item. This item is the direct parent of the specified child.
References _childItems, _childItemsMapById, _childItemsMapByLabel, associatedModel(), childCount(), data(), modelIndex(), and nameId().
void TreeItem::appendChild | ( | DataObject * | dataObject, |
const QStringList & | relativePath = QStringList() |
||
) |
This creates an item from the specified dataObject and put it in the decendency of this item at the specified relativePath. The created item could not be a direct child of this item in the case where the relative path is not null. Note that no reference on the dataObject is kept in this instance. Only the identifier is used to set the item identifier, and the properties may be used to set the values of the item (stored in columns).
References appendChild(), DataObject::getLabel(), DataObject::getNameId(), and nameId().
void TreeItem::appendChild | ( | const QString & | nameId, |
const QVector< QVariant > & | columnValues, | ||
const QStringList & | relativePath = QStringList() |
||
) |
References appendChild(), child(), childByLabel(), and TreeItem().
TreeModel * TreeItem::associatedModel | ( | ) |
References _associatedModel.
void TreeItem::associateToModel | ( | TreeModel * | model | ) |
This must be used to specified which model this item belongs to. It is required because the item sometimes requests its model for global informations about the data tree. In standard usage, this function is automatically set when the item is instantiated by requested the parent item. Then only the root item needs a manual setting.
References _associatedModel.
TreeItem * TreeItem::child | ( | int | row | ) |
The child() function returns the child that corresponds to the specified row number in the item's list of child items.
References _childItems.
References _childItemsMapById.
References _childItemsMapByLabel.
int TreeItem::childCount | ( | ) | const |
References _childItems.
int TreeItem::columnCount | ( | ) | const |
References _itemData.
QVariant TreeItem::data | ( | int | column | ) | const |
References _itemData.
|
private |
This initializes the tree item. Called by the constructors.
References _itemData, _itemNameId, _parentItem, associatedModel(), associateToModel(), nameId(), and parent().
QModelIndex TreeItem::modelIndex | ( | int | column = 0 | ) |
References _parentItem, associatedModel(), TreeModel::getRootItem(), TreeModel::index(), modelIndex(), and rowIndex().
QString TreeItem::nameId | ( | ) |
This provide an identifier for this item
References _itemNameId.
TreeItem * TreeItem::parent | ( | ) |
References _parentItem.
void TreeItem::removeChild | ( | TreeItem * | item | ) |
This removes the specified child to this item. This item is the direct parent of the specified child.
References _childItems, _childItemsMapById, _childItemsMapByLabel, associatedModel(), childCount(), data(), modelIndex(), and nameId().
void TreeItem::removeChild | ( | DataObject * | dataObject, |
const QStringList & | relativePath = QStringList() |
||
) |
References child(), childById(), childByLabel(), childCount(), DataObject::getNameId(), nameId(), and removeChild().
int TreeItem::rowIndex | ( | ) | const |
The rowIndex() function reports the item's location within its parent's list of items.
References _childItems, and _parentItem.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |