The TreeItem class is the item class used by the TreeModel class. More...
#include <Optika_treeitem.hpp>
Public Member Functions | |
Constructors/Destructor | |
TreeItem (const QString &name, RCP< ParameterEntry > parameterEntry, TreeItem *parent=0, bool isHeader=false) | |
Constructs a TreeItem object. More... | |
~TreeItem () | |
Deconstrcutor for the TreeItem. | |
Debugging fucntions | |
void | printOut () const |
Prints out the values in the TreeItem. | |
Getters and Setters | |
TreeItem * | child (int row) |
Returns the child treeitem in the row specified by the row argument. More... | |
RCP< const ParameterEntry > | getEntry () const |
Gets the ParameterEntry associated with this TreeItem. More... | |
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. More... | |
const QList< TreeItem * > | getChildItems () |
Gets a list of all the child items. More... | |
int | columnCount () const |
How man columns the TreeItem has. Should always be 3. More... | |
QVariant | data (int column, int role=Qt::DisplayRole) const |
Returns the data located in a particular column. More... | |
TreeItem * | parent () |
Gets the parent TreeItem. More... | |
int | row () const |
Returns the row in which this TreeItem is located. More... | |
bool | hasValidValue () const |
Determines whether or not the current value associated with the TreeItem is valid. More... | |
QString | getCurrentInvalidValueMessage () const |
Gets a message desribing the error with the current value. More... | |
void | appendChild (TreeItem *child) |
Appends a child TreeItem to the TreeItem. More... | |
bool | changeValue (QVariant value) |
Changes the value of the TreeItem. Should only be used with TreeItems that represent Parameters. More... | |
void | setValidator (RCP< const ParameterEntryValidator > validator) |
Sets the validator for the parameter the TreeItem represents. More... | |
static QString | getTypeId (const RCP< const ParameterEntry > parameter) |
Gets the type id to be used for the TreeItem. More... | |
Optika::TreeItem::TreeItem | ( | const QString & | name, |
RCP< ParameterEntry > | parameterEntry, | ||
TreeItem * | parent = 0 , |
||
bool | isHeader = false |
||
) |
Constructs a TreeItem object.
name | The name of the parameter entry. |
parameterEntry | The ParameterEntry this TreeItem is ment to represent. |
parent | The parent TreeItem. |
isHeader | Whether or not his treeitem represents a "header" tree item. |
References getTypeId().
void Optika::TreeItem::appendChild | ( | TreeItem * | child | ) |
bool Optika::TreeItem::changeValue | ( | QVariant | value | ) |
Changes the value of the TreeItem. Should only be used with TreeItems that represent Parameters.
value | The 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.
row | The row in which the child is in. |
Referenced by Optika::TreeModel::index().
int Optika::TreeItem::childCount | ( | ) | const |
Gets 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.
Referenced by Optika::TreeModel::columnCount().
QVariant Optika::TreeItem::data | ( | int | column, |
int | role = Qt::DisplayRole |
||
) | const |
Returns the data located in a particular column.
column | The column of the desired data. |
role | The role of the data. |
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.
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.
References data().
Referenced by Optika::TreeModel::setData().
|
inline |
|
static |
Gets the type id to be used for the TreeItem.
param | The parameter who's type is in question. |
Referenced by TreeItem().
bool Optika::TreeItem::hasValidValue | ( | ) | const |
Determines whether or not the current value associated with the TreeItem is valid.
References data().
Referenced by Optika::TreeModel::hasValidValue(), and Optika::TreeModel::setData().
TreeItem * Optika::TreeItem::parent | ( | ) |
int Optika::TreeItem::row | ( | ) | const |
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.
validator | The validator which the parameter should be given. |