#include <actiontreeitem.h>
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. |
NSCore::ActionTreeItem::ActionTreeItem | ( | QString | n, | |
QTreeItem * | p, | |||
QString | i = "" | |||
) |
Creates a new action.
n | the name of this action | |
p | the parent QTreeItem | |
i | the path to the icon |
Creates a new action.
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.
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...
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
int NSCore::ActionTreeItem::guiHint | ( | ) | const [inline] |
void NSCore::ActionTreeItem::setGuiHint | ( | int | n | ) | [inline] |
void NSCore::ActionTreeItem::addAction | ( | QString | path, | |
QString | tooltip = 0 | |||
) |
adds a new Parameter as child
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] |
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.
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.
role | is actually a combination of Qt::ItemDataRole |
Reimplemented from NSCore::QTreeItem.
QString NSCore::ActionTreeItem::iconPath | ( | ) | const [inline] |
void NSCore::ActionTreeItem::setIconPath | ( | QString | n | ) | [inline] |
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().
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.
node | The QDomNode to restore from |
Implements NSCore::QTreeItem.
int NSCore::ActionTreeItem::_guihint [private] |
QString NSCore::ActionTreeItem::_iconpath [private] |
QString NSCore::ActionTreeItem::iconPath [read, write] |
Path to the icon.
Can be either a real system-path or a relativ-qresource-path