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

The TreeItemBase class is the base class for all tree items, that is items which can be attached to TreeNode instances. More...

#include <TreeItemBase.h>

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

List of all members.

Signals

void modificationStateChanged (bool is_modified) const
 Implement this function as a signal when implementing the object.

Public Member Functions

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.
virtual bool hasCategory () const
 Checks if the item has a category.
virtual bool isModified () const
 Indicates the modification state of the object.
QObject * objectBase ()
 Returns the QObject* base of the interface.
const QObject * objectBase () const
 Returns a const QObject* base of the interface.
virtual bool removeCategory (int observer_id=-1)
virtual bool setCategory (const QtilitiesCategory &category, TreeNode *tree_node)
virtual bool setCategory (const QtilitiesCategory &category, int observer_id=-1)
virtual bool setCategoryString (const QString &category_string, const QString &sep="::")
 TreeItemBase (const QString &name=QString(), QObject *parent=0)
 Constructs the base of a tree item.
- Public Member Functions inherited from Qtilities::CoreGui::AbstractTreeItem
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.
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.
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.
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.
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.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IModificationNotifier
virtual void setModificationState (bool new_state, NotificationTargets notification_targets=NotifyListeners, bool force_notifications=false)=0
 Sets the modification state of the object. Returns true if it was successfull.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IObjectBase
QString objectOriginID () const
 Allows interfaces to provide some sort of source identification.
void setObjectOriginID (const QString &object_origin_id)
 Allows setting of the object source ID of this interface implementation.
- Public Member Functions inherited from Qtilities::Core::Interfaces::IExportable
quint32 applicationExportVersion () const
 Returns the application export version currently used by all your application's classes.
virtual void clearExportTask ()
 Clears the export task.
IExportableduplicate (QString *error_msg=0, int properties_to_copy=0, ExportResultFlags *result_flags=0) const
 Function which will create a duplicate (copy) of this object.
virtual ExportResultFlags exportBinary (QDataStream &stream) const
 Allows exporting to a QDataStream.
virtual ITaskexportTask () const
 Gets the task which must be used to log import/export information to.
Qtilities::ExportVersion exportVersion () const
 Returns the export version currently used by all Qtilities classes.
virtual ExportResultFlags exportXml (QDomDocument *doc, QDomElement *object_node) const
 Allows exporting to an XML document. A reference to the QDomElement to which the object's information must be added is provided, along with a reference to the QDomDocument.
virtual ExportResultFlags importBinary (QDataStream &stream, QList< QPointer< QObject > > &import_list)
 Allows importing and reconstruction of the object state from information provided in a QDataStream.
virtual ExportResultFlags importXml (QDomDocument *doc, QDomElement *object_node, QList< QPointer< QObject > > &import_list)
 Allows importing and reconstruction of data from information provided in a XML document. A reference to the QDomElement which contains the object's information is provided, along with a reference to the QDomDocument.
virtual InstanceFactoryInfo instanceFactoryInfo () const
 The instance factory information which must be used when the exported object is reconstructed during an import.
bool isExportable () const
 Gets if this object must be part of it's parents' exports.
virtual void setApplicationExportVersion (quint32 version)
 Sets the application export version currently used by all your application's classes.
virtual void setExportTask (ITask *task)
 Sets the task which must be used to log import/export information to.
virtual void setExportVersion (Qtilities::ExportVersion version)
 Returns the export version currently used by all Qtilities classes.
virtual void setIsExportable (bool new_is_exportable)
 Sets if this object must be part of it's parents' exports.
virtual ExportModeFlags supportedFormats () const
 Provides information about the export format(s) supported by your implementation of IExportable.

Additional Inherited Members

- Public Types inherited from Qtilities::Core::Interfaces::IModificationNotifier
enum  NotificationTarget { NotifyNone = 0, NotifyListeners = 1, NotifySubjects = 2 }
 The targets which should be notified when the state of the object implementing this interface changes. More...
- Public Types inherited from Qtilities::Core::Interfaces::IExportable
enum  ExportMode { None = 0, Binary = 1, XML = 2 }
 Possible export modes that an implementation of IExportable can support. More...
enum  Result {
  Complete = 0, Incomplete = 1, Failed = 2, FailedContinue = 4,
  VersionTooNew = 8, VersionTooOld = 16, VersionSupported = 32, SuccessResult = Complete | Incomplete | VersionSupported,
  FailedResult = Failed | FailedContinue | VersionTooNew | VersionTooOld
}
 The possible results of an export/import operation. More...
- Static Public Member Functions inherited from Qtilities::Core::Interfaces::IExportable
template<typename T >
static T * duplicateInstance (IExportable *obj, QString *error_msg=0, int properties_to_copy=0, ExportResultFlags *result_flags=0)
 Provides an easy to use template based implementation of IExportable::duplicate().
static QString exportModeToString (ExportMode export_mode)
 Function which returns a string associated with a specific ExportMode.
static ExportMode stringToExportMode (const QString &export_mode_string)
 Function which returns the ExportMode associated with a string.
static Result validateQtilitiesExportVersion (Qtilities::ExportVersion export_version, ITask *task=0)
 Checks the exportVersion() against the supported Qtilities export versions for the current Qtilities version.
static Result validateQtilitiesImportVersion (Qtilities::ExportVersion import_version, ITask *task=0)
 Checks the exportVersion() against the supported Qtilities import versions for the current Qtilities version.
- Protected Member Functions inherited from Qtilities::CoreGui::AbstractTreeItem
IExportable::ExportResultFlags saveFormattingToXML (QDomDocument *doc, QDomElement *object_node, Qtilities::ExportVersion version) const

Detailed Description

The TreeItemBase class is the base class for all tree items, that is items which can be attached to TreeNode instances.

This class was added in Qtilities v0.2.


Constructor & Destructor Documentation

Qtilities::CoreGui::TreeItemBase::TreeItemBase ( const QString &  name = QString(),
QObject *  parent = 0 
)

Constructs the base of a tree item.

Parameters:
nameThe name of the item.
parentThe parent of the item.

Member Function Documentation

Qtilities::Core::QtilitiesCategory Qtilities::CoreGui::TreeItemBase::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 from Qtilities::CoreGui::AbstractTreeItem.

Qtilities::Core::QtilitiesCategory Qtilities::CoreGui::TreeItemBase::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 from Qtilities::CoreGui::AbstractTreeItem.

QString Qtilities::CoreGui::TreeItemBase::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 from Qtilities::CoreGui::AbstractTreeItem.

void Qtilities::CoreGui::TreeItemBase::modificationStateChanged ( bool  is_modified) const
virtualsignal

Implement this function as a signal when implementing the object.

Because this interface does not use the Q_OBJECT macro, you cannot connect to this signal directly. Instead you need to connect to the signal on the base object implementing this interface as follows:

connect(iface->objectBase(),SIGNAL(modificationStateChanged(bool)),SLOT(yourSlot(bool)));

Implements Qtilities::Core::Interfaces::IModificationNotifier.

const QObject* Qtilities::CoreGui::TreeItemBase::objectBase ( ) const
inlinevirtual

Returns a const QObject* base of the interface.

This function can be used in const methods, but make sure that you don't modify things that should stay const. An example where this is used is when we want to get a property on an object in a const method. This is a const operation.

Implements Qtilities::Core::Interfaces::IObjectBase.

bool Qtilities::CoreGui::TreeItemBase::removeCategory ( int  observer_id = -1)
virtual

This function will automatically call setModificationState(true) when needed.

Reimplemented from Qtilities::CoreGui::AbstractTreeItem.

bool Qtilities::CoreGui::TreeItemBase::setCategory ( const QtilitiesCategory category,
TreeNode tree_node 
)
virtual

This function will automatically call setModificationState(true) when needed.

Reimplemented from Qtilities::CoreGui::AbstractTreeItem.

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

This function will automatically call setModificationState(true) when needed.

Reimplemented from Qtilities::CoreGui::AbstractTreeItem.

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

This function will automatically call setModificationState(true) when needed.

Reimplemented from Qtilities::CoreGui::AbstractTreeItem.



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