All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Protected Member Functions
Qtilities::CoreGui::AbstractTreeItem Class Reference

The AbstractTreeItem is an abstract base class which can be used to build tree items. More...

#include <AbstractTreeItem.h>

Inheritance diagram for Qtilities::CoreGui::AbstractTreeItem:
Inheritance graph
[legend]

List of all members.

Public Member Functions

Qt::AlignmentFlag getAlignment () const
 Gets the alignement of the tree item.
QColor getBackgroundColor () const
 Gets the background color of the tree item.
QBrush getBackgroundRole () const
 Gets the background role of the tree item.
virtual QtilitiesCategory getCategory (TreeNode *tree_node) const
 Gets the category of the tree item in the specified tree node.
virtual QtilitiesCategory getCategory (int observer_id=-1) const
 Gets the category of the tree item in the context specified by the given observer ID.
virtual QString getCategoryString (const QString &sep="::", int observer_id=-1) const
 Gets the category in a string format where different hierarchies of the category is split using sep.
QFont getFont () const
 Gets the font of the tree item.
QColor getForegroundColor () const
 Gets the foreground color of the tree item.
QBrush getForegroundRole () const
 Gets the foreground role of the tree item.
QIcon getIcon () const
 Gets the icon of the tree item.
QString getName (TreeNode *parent=0) const
 Function to get the name of this tree item.
QSize getSizeHint () const
 Gets the size hint of the tree item.
QString getStatusTip () const
 Gets the status tip of the tree item.
QString getToolTip () const
 Gets the tool tip of the tree item.
QString getWhatsThis () const
 Gets the what's this text of the tree item.
bool hasAlignment () const
 Checks if the item has a font.
bool hasBackgroundRole () const
 Checks if the item has a background role.
virtual bool hasCategory () const
 Checks if the item has a category.
bool hasFont () const
 Checks if the item has a font.
bool hasForegroundRole () const
 Checks if the item has a foreground role.
bool hasIcon () const
 Checks if the item has an icon.
bool hasSizeHint () const
 Checks if the item has a size hint.
bool hasStatusTip () const
 Checks if the item has status tip text.
bool hasToolTip () const
 Checks if the item has a tool tip.
bool hasWhatsThis () const
 Checks if the item has what's this text.
virtual bool removeCategory (int observer_id=-1)
 Removes the current category of this tree item for the specified observer context.
void setAlignment (const Qt::AlignmentFlag &alignment)
 Sets the alignment of the tree item.
void setBackgroundColor (const QColor &color)
 Sets the background color of the tree item.
void setBackgroundRole (const QBrush &background_role)
 Sets the background role of the tree item.
virtual bool setCategory (const QtilitiesCategory &category, TreeNode *tree_node)
 Sets the category of the tree item in the specified tree node.
virtual bool setCategory (const QtilitiesCategory &category, int observer_id=-1)
 Sets the category of the tree item in the context specified by the given observer ID.
virtual bool setCategoryString (const QString &category_string, const QString &sep="::")
 Sets the category in a string format where different hierarchies of the category is split using sep.
void setFont (const QFont &font)
 Sets the font of the tree item.
void setForegroundColor (const QColor &color)
 Sets the foreground color of the tree item.
void setForegroundRole (const QBrush &foreground_role)
 Sets the foreground role of the tree item.
void setIcon (const QIcon &icon)
 Sets the icon of the tree item.
bool setName (const QString &new_name, Observer *parent=0)
 Function to set the name of this tree item.
void setSizeHint (const QSize &size)
 Sets the size hint of the tree item.
void setStatusTip (const QString &status_tip)
 Sets the status tip of the tree item.
void setToolTip (const QString &tooltip)
 Sets the tool tip of the tree item.
void setWhatsThis (const QString &whats_this)
 Sets the what's this text of the tree item.

Protected Member Functions

IExportable::ExportResultFlags saveFormattingToXML (QDomDocument *doc, QDomElement *object_node, Qtilities::ExportVersion version) const

Detailed Description

The AbstractTreeItem is an abstract base class which can be used to build tree items.

This class was added in Qtilities v0.2.


Member Function Documentation

QColor Qtilities::CoreGui::AbstractTreeItem::getBackgroundColor ( ) const

Gets the background color of the tree item.

Returns:
The background color if it has been set, QColor() otherwise.
Qtilities::Core::QtilitiesCategory Qtilities::CoreGui::AbstractTreeItem::getCategory ( TreeNode tree_node) const
virtual

Gets the category of the tree item in the specified tree node.

Parameters:
tree_nodeThe node context for which the category must be obtained for.
Note:
If this tree item is not attached to any tree node, this function does nothing and returns false.

Reimplemented in Qtilities::CoreGui::TreeItemBase.

QtilitiesCategory Qtilities::CoreGui::AbstractTreeItem::getCategory ( int  observer_id = -1) const
virtual

Gets the category of the tree item in the context specified by the given observer ID.

Parameters:
observer_idThe observer ID of the context for which the category must be obtained for. When -1, the function will find the parent in the following way:
  • It will check if the item has only one parent. If that is the case, the category in this parent will be used. that the item only has 1 parent and it will check if it has only one parent and if so, return the category for that parent.
  • If the item has more than one parent, the function will check if the item has a specific parent (thus it was attached using Observer::SpecificObserverOwnership). If it does have a specific parent, the category in this parent will be used.

If none of the above conditions were met the function will print an error message.

Note:
If this tree item is not attached to any tree node, this function does nothing and returns an empty category.

Reimplemented in Qtilities::CoreGui::TreeItemBase.

QString Qtilities::CoreGui::AbstractTreeItem::getCategoryString ( const QString &  sep = "::",
int  observer_id = -1 
) const
virtual

Gets the category in a string format where different hierarchies of the category is split using sep.

Parameters:
observer_idThe observer ID of the context for which the category must be obtained for. When -1, the function will find the parent in the following way:
  • It will check if the item has only one parent. If that is the case, the category in this parent will be used. that the item only has 1 parent and it will check if it has only one parent and if so, return the category for that parent.
  • If the item has more than one parent, the function will check if the item has a specific parent (thus it was attached using Observer::SpecificObserverOwnership). If it does have a specific parent, the category in this parent will be used.

If none of the above conditions were met the function will print an error message.

Reimplemented in Qtilities::CoreGui::TreeItemBase.

QColor Qtilities::CoreGui::AbstractTreeItem::getForegroundColor ( ) const

Gets the foreground color of the tree item.

Returns:
The foreground color if it has been set, QColor() otherwise.
QString Qtilities::CoreGui::AbstractTreeItem::getName ( TreeNode parent = 0) const

Function to get the name of this tree item.

Parameters:
parentThe name of the parent node which provides the context in which we want to get the name. By default gets the objectName(). If a parent is specified which does not contain this item, QString() is returned.
bool Qtilities::CoreGui::AbstractTreeItem::removeCategory ( int  observer_id = -1)
virtual

Removes the current category of this tree item for the specified observer context.

If no context is specified, the complete multi context category property is removed.

Note:
If this tree item is not attached to any tree node, this function does nothing.
Returns:
True if the category was successfully removed, false otherwise. Note that false will also be returned if the category did not exist for the given observer context, or when observer_id = -1 and there was no category propery, false will also be returned.
See also:
setCategory(), getCategory()

Reimplemented in Qtilities::CoreGui::TreeItemBase.

IExportable::ExportResultFlags Qtilities::CoreGui::AbstractTreeItem::saveFormattingToXML ( QDomDocument *  doc,
QDomElement *  object_node,
Qtilities::ExportVersion  version 
) const
protected

This function will add a formatting node to object_node with the formatting information of this item. At present the following information is part of the formatting export:

  • Background Color (Only the color)
  • Foreground Color (Only the color)
  • Size Hint
  • Status Tip
  • Tool Tip
  • Font

The following information is not part of the formatting export:

  • Alignment
  • Icon
Note:
Category: The category is not part of the export. It is part of this item's item node.
void Qtilities::CoreGui::AbstractTreeItem::setBackgroundColor ( const QColor &  color)

Sets the background color of the tree item.

Note:
If this function is called after setBackgroundRole(), the color of the brush set with that function will be changed.
bool Qtilities::CoreGui::AbstractTreeItem::setCategory ( const QtilitiesCategory category,
TreeNode tree_node 
)
virtual

Sets the category of the tree item in the specified tree node.

Returns:
True if the category was successfully set. False otherwise. Note that false will be returned when the category is the same as the current category and therefore will not be changed.

Reimplemented in Qtilities::CoreGui::TreeNode, and Qtilities::CoreGui::TreeItemBase.

bool Qtilities::CoreGui::AbstractTreeItem::setCategory ( const QtilitiesCategory category,
int  observer_id = -1 
)
virtual

Sets the category of the tree item in the context specified by the given observer ID.

Parameters:
observer_idThe observer ID of the context for which the category must be obtained for. When -1, the function will find the parent in the following way:
  • It will check if the item has only one parent. If that is the case, the category in this parent will be used. that the item only has 1 parent and it will check if it has only one parent and if so, return the category for that parent.
  • If the item has more than one parent, the function will check if the item has a specific parent (thus it was attached using Observer::SpecificObserverOwnership). If it does have a specific parent, the category in this parent will be used.

If none of the above conditions were met the function will print an error message in release mode and assert in debug mode.

Returns:
True if the category was successfully set. False otherwise. Note that true will be returned when the category is the same as the current category and therefore will not be changed.
Note:
If this tree item is not attached to any tree node, this function does nothing and returns false.
See also:
removeCategory(), getCategory()

Reimplemented in Qtilities::CoreGui::TreeNode, and Qtilities::CoreGui::TreeItemBase.

bool Qtilities::CoreGui::AbstractTreeItem::setCategoryString ( const QString &  category_string,
const QString &  sep = "::" 
)
virtual

Sets the category in a string format where different hierarchies of the category is split using sep.

Note:
If this tree item is not attached to any tree node, this function does nothing and return false.

Reimplemented in Qtilities::CoreGui::TreeItemBase.

void Qtilities::CoreGui::AbstractTreeItem::setForegroundColor ( const QColor &  color)

Sets the foreground color of the tree item.

Note:
If this function is called after setForegroundRole(), the color of the brush set with that function will be changed.
bool Qtilities::CoreGui::AbstractTreeItem::setName ( const QString &  new_name,
Observer parent = 0 
)

Function to set the name of this tree item.

Parameters:
parentThe name of the parent node which provides the context in which we want to set the name.
Returns:
True when changed successfully, false otherwise.


Qtilities : Reference Documentation Back to top Copyright © 2009-2013, Jaco Naudé