NSCore::ActionTreeItem Class Reference

Action in a tree-like structure. More...

#include <actiontreeitem.h>

Inheritance diagram for NSCore::ActionTreeItem:

NSCore::QTreeItem QObject NSCore::PointerProtection_Skel
Collaboration diagram for NSCore::ActionTreeItem:

Collaboration graph
[legend]

List of all members.

Public Slots

void exec ()
 Execute the action from scripts/etc.

Signals

void activated ()
 Execute the desired action.

Public Member Functions

 ActionTreeItem (QString n, QTreeItem *p, QString i="")
 Creates a new action.
 ActionTreeItem (QString n, QTreeItem *p, QObject *o, const char *s)
 Creates a new action.
 ActionTreeItem (QString n, QTreeItem *p, QString i, QObject *o, const char *s)
 Creates a new action.
 ActionTreeItem (ActionTreeItem &item, QTreeItem *p)
 Copy a ActionTreeItem and possibly its childs into another tree.
 ~ActionTreeItem ()
 destructor
int guiHint () const
 Returns the guiHint.
void setGuiHint (int n)
 Set the guiHint.
void addAction (QString path, QString tooltip=0)
 adds a new Parameter as child
QVariant guiValue () const
 GUI: return a/the value to display.
void guiSetValue (QVariant)
 GUI: set the value.
Qt::ItemFlags guiFlags () const
 GUI: the Flags for this item.
QStringList guiActions () const
 GUI: return the supported actions.
void guiExecAction (QString, GuiServer_Interface *)
 GUI: execute the named action.
QVariant guiIdentifier (int role) const
 GUI: return different types of data used to identify the treeitem.
QString iconPath () const
 Return the path of the icon for this action.
void setIconPath (QString n)
 Set the path of the icon for this action.

Properties

QString iconPath
 Path to the icon.

Private Member Functions

QString debug () const
 Custom debug text.
QDomNode saveToXML (QDomDocument)
 Store the information of this element into a new QDomElement.
bool needsToSaveToXml ()
 Whether this item needs to be saved or not.
bool restoreFromXML (QDomNode)
 Restore the state of this element from the given QDomNode.
 ActionTreeItem (const ActionTreeItem &)
 masked copy-constructor

Private Attributes

int _guihint
 Internal storage of the guihint.
QString _iconpath
 Internal storage of the iconpath.


Detailed Description

Action in a tree-like structure.

Constructor & Destructor Documentation

NSCore::ActionTreeItem::ActionTreeItem ( QString  n,
QTreeItem p,
QString  i = "" 
)

Creates a new action.

Parameters:
n the name of this action
p the parent QTreeItem
i the path to the icon

NSCore::ActionTreeItem::ActionTreeItem ( QString  n,
QTreeItem p,
QObject o,
const char *  s 
)

Creates a new action.

Parameters:
n the name of this action
p the parent QTreeItem
o the object to send the signal to
s the slot to connect to

NSCore::ActionTreeItem::ActionTreeItem ( QString  n,
QTreeItem p,
QString  i,
QObject o,
const char *  s 
)

Creates a new action.

Parameters:
n the name of this action
p the parent QTreeItem
o the object to send the signal to
s the slot to connect to
i the path to the icon

NSCore::ActionTreeItem::ActionTreeItem ( ActionTreeItem item,
QTreeItem p 
)

Copy a ActionTreeItem and possibly its childs into another tree.

Childs are only copied if they are also ActionTreeItems...

Parameters:
item The item that is to be copied
p The parent of the new item

NSCore::ActionTreeItem::~ActionTreeItem (  ) 

destructor

NSCore::ActionTreeItem::ActionTreeItem ( const ActionTreeItem  )  [inline, private]

masked copy-constructor

has to be private since the new parent needs to be known


Member Function Documentation

int NSCore::ActionTreeItem::guiHint (  )  const [inline]

Returns the guiHint.

References _guihint.

void NSCore::ActionTreeItem::setGuiHint ( int  n  )  [inline]

Set the guiHint.

References _guihint.

void NSCore::ActionTreeItem::addAction ( QString  path,
QString  tooltip = 0 
)

adds a new Parameter as child

Parameters:
path The path to the new item.
tooltip A string to be shown as tooltip in GUIs.

QVariant NSCore::ActionTreeItem::guiValue (  )  const [inline, virtual]

GUI: return a/the value to display.

If you implement this, always remember to call the parent guiValue() if you can't return the right thing.

Reimplemented from NSCore::QTreeItem.

void NSCore::ActionTreeItem::guiSetValue ( QVariant   )  [inline, virtual]

GUI: set the value.

This function will be called by GUIs to change the value. You should implement it accordingly.

Reimplemented from NSCore::QTreeItem.

Qt::ItemFlags NSCore::ActionTreeItem::guiFlags (  )  const [virtual]

GUI: the Flags for this item.

Reimplemented from NSCore::QTreeItem.

QStringList NSCore::ActionTreeItem::guiActions (  )  const [virtual]

GUI: return the supported actions.

These actions will get symbols/buttons to get executed.

If you implement this, remember to call the parent guiActions() too:

 SomeTreeItem::guiActions() const {
   return QStringList() << <your actions> << BaseClass::guiActions();
 }

Reimplemented from NSCore::QTreeItem.

void NSCore::ActionTreeItem::guiExecAction ( QString  n,
GuiServer_Interface gui 
) [virtual]

GUI: execute the named action.

If you implemented guiActions() you will also want to implement this. If you can't handle the named action yourself, call guiExecAction() of the parent class.

Of course this can also be used as a filter if you want to restrict access to actions of the parent class.

The second parameter lets you interact with the user by some basic means.

Parameters:
n The action to execute
gui The gui to use for interactions

Reimplemented from NSCore::QTreeItem.

QVariant NSCore::ActionTreeItem::guiIdentifier ( int  role  )  const [virtual]

GUI: return different types of data used to identify the treeitem.

Things like the name, icon, statustip, tooltip and so on will be accessed by this.

Parameters:
role is actually a combination of Qt::ItemDataRole

Reimplemented from NSCore::QTreeItem.

QString NSCore::ActionTreeItem::iconPath (  )  const [inline]

Return the path of the icon for this action.

References _iconpath.

void NSCore::ActionTreeItem::setIconPath ( QString  n  )  [inline]

Set the path of the icon for this action.

References _iconpath.

void NSCore::ActionTreeItem::exec (  )  [slot]

Execute the action from scripts/etc.

void NSCore::ActionTreeItem::activated (  )  [signal]

Execute the desired action.

Connect this signal to your slot that should get executed by the gui.

QString NSCore::ActionTreeItem::debug (  )  const [inline, private, virtual]

Custom debug text.

This function has to be implemented and has to return the internal debug-data that is to be printed...

Implements NSCore::QTreeItem.

QDomNode NSCore::ActionTreeItem::saveToXML ( QDomDocument  doc  )  [private, virtual]

Store the information of this element into a new QDomElement.

This function is only to save the state of this element, all the recursive stuff will be done by toXml().

Parameters:
doc The QDomDocument to use for creation of the element

Implements NSCore::QTreeItem.

bool NSCore::ActionTreeItem::needsToSaveToXml (  )  [inline, private, virtual]

Whether this item needs to be saved or not.

If the item itself and all its childs don't need to be saved, it will be skipped.

The default is to save.

Reimplemented from NSCore::QTreeItem.

bool NSCore::ActionTreeItem::restoreFromXML ( QDomNode  node  )  [private, virtual]

Restore the state of this element from the given QDomNode.

You don't have to do the recursive stuff here, that is handled in fromXml() for you. Only the things done in saveToXML need/can be restored here.

If you succeeded and want the childs to be restored too, return true.

Parameters:
node The QDomNode to restore from

Implements NSCore::QTreeItem.


Member Data Documentation

Internal storage of the guihint.

Referenced by guiHint(), and setGuiHint().

Internal storage of the iconpath.

Referenced by iconPath(), and setIconPath().


Property Documentation

QString NSCore::ActionTreeItem::iconPath [read, write]

Path to the icon.

Can be either a real system-path or a relativ-qresource-path


The documentation for this class was generated from the following file:

Generated on Tue Apr 12 02:10:24 2011 for epos by  doxygen 1.5.5