Label Class Reference

The basis of the hierarchical labels. More...

#include <label.h>

List of all members.

Public Member Functions

 Label ()
 Label (QString text)
 ~Label ()
int getIndex () const
QString getText ()
void setText (QString text)
LabelgetParent ()
LabelgetChild (int index)
bool addChild (int index, Label *child)
bool addChildren (int position, int count)
bool removeChildren (int position, int count)
void appendChild (Label *child)
int childCount ()
QStringList toStringList ()
bool contains (QString labelText)

Protected Member Functions

void setParent (Label *parent)

Detailed Description

The basis of the hierarchical labels.

This class presents the structure of the hierarchical labels. It contains of functions to access its children and its parent. The most importent member is the text. It contains the value of the label that will be displayed to the user. The class is not used in the Node class because the nodes just contain a list of QStrings. The hierarchical labels are suposed to help the user to assign labels to a node. Thats their only assignment.

Author:
Manuel Unglaub

Constructor & Destructor Documentation

Label::Label (  ) 

A constructor.

Constructs a Label with parent = 0 and text = "".

Label::Label ( QString  text  ) 

A constructor.

Constructs a Label with parent = 0 and text initialized with the text parameter.

Parameters:
text Setting the text of the Label to text.
Label::~Label (  ) 

The destructor.

Destroys the Label and all its children.


Member Function Documentation

bool Label::addChild ( int  index,
Label child 
)

Add a child to the Label at a specified index.

Parameters:
index The index where the child will be inserted in the list of children in this Label. If the index is 0 it will be prepended to the list. If it is childCount() it will be appended. The child will only be inserted if the index is greater or equal to 0 and less or equal to childCount().
child The child that will be inserted in the list of children of this Label.
Returns:
True if the child was successfull inserted.
bool Label::addChildren ( int  position,
int  count 
)

Creates a specified number of children at a specified position.

Parameters:
position The index where the children will be inserted in the list of children in this Label. If the index is 0 they will be prepended to the list. If it is childCount() they will be appended. The children will only be created if the index is greater or equal to 0 and less or equal to childCount().
count The number of children that will be created.
Returns:
True if all children are successfull created.
void Label::appendChild ( Label child  ) 

Append a child to this Label.

Parameters:
child The child that will be appended to the list of children of this Label.
int Label::childCount (  ) 

Get the number of children of this Label.

Returns:
The number of children of this Label.
bool Label::contains ( QString  labelText  ) 

Find out if this Label or one of its sublabels members text contains the specified text.

Parameters:
labelText The exact text to look for.
Returns:
True if this Label or its sublabels contain a member text with the value of the parameter labelText.
Label * Label::getChild ( int  index  ) 

Get the child of this Label at the specified index.

Parameters:
index The index of the child. It must be between 0 and the childCount().
Returns:
The child at the specified index. If the index is not valid it will return 0.
int Label::getIndex (  )  const

Get the index of this Label in its parents childlist.

Returns:
The index of this Label. If it has no parent it will return 0.
Label * Label::getParent (  ) 

Get the parent of this Label.

Returns:
The parent of this Label. If there is no parent it will return 0.
QString Label::getText (  ) 

Get the text of this Label.

Returns:
The text of this Label.
bool Label::removeChildren ( int  position,
int  count 
)

Deletes the specified number of children at the specified position.

Parameters:
position The index of the first child that will be removed. The position must be greater or equal to 0 and less or equal to childCount() - count.
count The number of children that will be removed.
Returns:
True if all children are successfull removed.
void Label::setParent ( Label parent  )  [protected]

Set the parent of this Label.

Parameters:
parent The parent of this Label will be set to this parameter.
void Label::setText ( QString  text  ) 

Set the text of this Label.

Parameters:
text Set the member text to the parameter text.
QStringList Label::toStringList (  ) 

Get a QStringList of this Label and all its sublabels. The list contains the member text of all these Labels.

Returns:
A QStringList of this Label and al its sublabels.

The documentation for this class was generated from the following files:
Generated on Fri May 14 19:12:51 2010 for Silence by  doxygen 1.6.3