Optika Development
Optika::TreeItem Class Reference

The TreeItem class is the item class used by the TreeModel class. More...

#include <Optika_treeitem.hpp>

Collaboration diagram for Optika::TreeItem:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Constructors/Destructor
 TreeItem (const QString &name, RCP< ParameterEntry > parameterEntry, TreeItem *parent=0, bool isHeader=false)
 Constructs a TreeItem object.
 ~TreeItem ()
 Deconstrcutor for the TreeItem.
Debugging fucntions
void printOut () const
 Prints out the values in the TreeItem.

Getters and Setters

TreeItemchild (int row)
 Returns the child treeitem in the row specified by the row argument.
RCP< const ParameterEntry > getEntry () const
 Gets the ParameterEntry associated with this TreeItem.
bool hasEntry () const
 Returns whether or not this TreeItem has a ParameterEntry associated with it.
int childCount () const
 Gets the number of child nodes this item has.
const QList< TreeItem * > getChildItems ()
 Gets a list of all the child items.
int columnCount () const
 How man columns the TreeItem has. Should always be 3.
QVariant data (int column, int role=Qt::DisplayRole) const
 Returns the data located in a particular column.
TreeItemparent ()
 Gets the parent TreeItem.
int row () const
 Returns the row in which this TreeItem is located.
bool hasValidValue () const
 Determines whether or not the current value associated with the TreeItem is valid.
QString getCurrentInvalidValueMessage () const
 Gets a message desribing the error with the current value.
void appendChild (TreeItem *child)
 Appends a child TreeItem to the TreeItem.
bool changeValue (QVariant value)
 Changes the value of the TreeItem. Should only be used with TreeItems that represent Parameters.
void setValidator (RCP< const ParameterEntryValidator > validator)
 Sets the validator for the parameter the TreeItem represents.
static QString getTypeId (const RCP< const ParameterEntry > parameter)
 Gets the type id to be used for the TreeItem.

Detailed Description

The TreeItem class is the item class used by the TreeModel class.


Constructor & Destructor Documentation

Optika::TreeItem::TreeItem ( const QString &  name,
RCP< ParameterEntry >  parameterEntry,
TreeItem parent = 0,
bool  isHeader = false 
)

Constructs a TreeItem object.

Parameters:
nameThe name of the parameter entry.
parameterEntryThe ParameterEntry this TreeItem is ment to represent.
parentThe parent TreeItem.
isHeaderWhether or not his treeitem represents a "header" tree item.

References getTypeId().


Member Function Documentation

void Optika::TreeItem::appendChild ( TreeItem child)

Appends a child TreeItem to the TreeItem.

Parameters:
childThe child item to be appended.
bool Optika::TreeItem::changeValue ( QVariant  value)

Changes the value of the TreeItem. Should only be used with TreeItems that represent Parameters.

Parameters:
valueThe new value to be assigned to the TreeItem.

Referenced by Optika::TreeModel::setData().

TreeItem * Optika::TreeItem::child ( int  row)

Returns the child treeitem in the row specified by the row argument.

Parameters:
rowThe row in which the child is in.
Returns:
The child TreeItem located in the row.

Referenced by Optika::TreeModel::index().

int Optika::TreeItem::childCount ( ) const

Gets the number of child nodes this item has.

Returns:
The number of child nodes this item has.

Referenced by Optika::TreeModel::rowCount().

int Optika::TreeItem::columnCount ( ) const

How man columns the TreeItem has. Should always be 3.

Returns:
The number of columns the TreeItem has.

Referenced by Optika::TreeModel::columnCount().

QVariant Optika::TreeItem::data ( int  column,
int  role = Qt::DisplayRole 
) const

Returns the data located in a particular column.

Parameters:
columnThe column of the desired data.
roleThe role of the data.
Returns:
The data located in a particular column.

References Optika::TreeModel::getRawDataRole().

Referenced by Optika::TreeModel::data(), getCurrentInvalidValueMessage(), hasValidValue(), and Optika::TreeModel::headerData().

const QList< TreeItem * > Optika::TreeItem::getChildItems ( )

Gets a list of all the child items.

Returns:
A list of all child items.
QString Optika::TreeItem::getCurrentInvalidValueMessage ( ) const

Gets a message desribing the error with the current value.

This funciton returns the error message generated by the validator should this treeitem's current value be invalid. If the current value is actually valid then this function simply returns an empty string. If there is no validator on this treeitem then an empty string is returned.

Returns:
The error message generated by the validator. If the current value is valid or there is no validator then the string is empty.

References data().

Referenced by Optika::TreeModel::setData().

RCP<const ParameterEntry> Optika::TreeItem::getEntry ( ) const [inline]

Gets the ParameterEntry associated with this TreeItem.

Returns:
The ParameterEntry associated with this TreeItem. If this tree item does not have a parameterEntry, null is returned.
QString Optika::TreeItem::getTypeId ( const RCP< const ParameterEntry >  parameter) [static]

Gets the type id to be used for the TreeItem.

Parameters:
paramThe parameter who's type is in question.
Returns:
The type id for the parameter.

Referenced by TreeItem().

bool Optika::TreeItem::hasValidValue ( ) const

Determines whether or not the current value associated with the TreeItem is valid.

Returns:
True if the value is valid, false otherwise.

References data().

Referenced by Optika::TreeModel::hasValidValue(), and Optika::TreeModel::setData().

TreeItem * Optika::TreeItem::parent ( )

Gets the parent TreeItem.

Returns:
The parent TreeItem.

Referenced by Optika::TreeModel::parent().

int Optika::TreeItem::row ( ) const

Returns the row in which this TreeItem is located.

Returns:
The row in which this TreeItem is located.

Referenced by Optika::TreeModel::parent().

void Optika::TreeItem::setValidator ( RCP< const ParameterEntryValidator >  validator)

Sets the validator for the parameter the TreeItem represents.

Parameters:
validatorThe validator which the parameter should be given.

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs