Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TreeItem Class Reference

#include <TreeItem.hxx>

Public Member Functions

 TreeItem (const QString &nameId, const QVector< QVariant > &columnValues, TreeItem *parent=0)
 
 ~TreeItem ()
 
QString nameId ()
 
void associateToModel (TreeModel *model)
 
TreeModelassociatedModel ()
 
QModelIndex modelIndex (int column=0)
 
TreeItemparent ()
 
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())
 
TreeItemchild (int row)
 
TreeItemchildById (const QString &nameId)
 
TreeItemchildByLabel (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
 

Constructor & Destructor Documentation

TreeItem::TreeItem ( const QString &  nameId,
const QVector< QVariant > &  columnValues,
TreeItem parent = 0 
)

References initialize().

TreeItem::~TreeItem ( )

Member Function Documentation

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() 
)
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.

TreeItem * TreeItem::childById ( const QString &  nameId)

References _childItemsMapById.

TreeItem * TreeItem::childByLabel ( const QString &  label)

References _childItemsMapByLabel.

int TreeItem::childCount ( ) const

References _childItems.

int TreeItem::columnCount ( ) const

References _itemData.

QVariant TreeItem::data ( int  column) const

References _itemData.

void TreeItem::initialize ( const QString &  nameId,
const QVector< QVariant > &  columnValues,
TreeItem parent 
)
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)
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() 
)
int TreeItem::rowIndex ( ) const

The rowIndex() function reports the item's location within its parent's list of items.

References _childItems, and _parentItem.

bool TreeItem::setData ( int  column,
const QVariant &  value 
)

References _itemData.

Member Data Documentation

TreeModel* TreeItem::_associatedModel
private
QList<TreeItem*> TreeItem::_childItems
private
QMap<QString, TreeItem *> TreeItem::_childItemsMapById
private
QMap<QString, TreeItem *> TreeItem::_childItemsMapByLabel
private
QVector<QVariant> TreeItem::_itemData
private
QString TreeItem::_itemNameId
private
TreeItem* TreeItem::_parentItem
private

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