#include <namedparametertreeitem.h>
Public Types | |
enum | GuiHint { ReadAllowed = 1, WriteAllowed = 2, ReadWrite = 3, ProvideReset = 4, Counter = 5, UrlRead = 1, UrlWrite = 2, UrlDir = 8 } |
Hint-types for the GUI. More... | |
Public Slots | |
void | setValue (QVariant) |
Set the value. | |
void | setMin (QVariant) |
Sets the minimum allowed. | |
void | setMax (QVariant) |
Sets the maximum allowed. | |
void | setRange (QVariant min, QVariant max) |
Sets min and max. | |
void | reset () |
Reset the value to the default. | |
void | setValue (int) |
Set the value. | |
void | setValue (bool) |
Set the value. | |
void | setValue (double) |
Set the value. | |
void | setValue (QString) |
Set the value. | |
void | setValue (QUrl) |
Set the value. | |
Signals | |
void | valueChanged () |
Signal changed values. | |
void | valueChanged (QVariant) |
Signal changed values. | |
void | valueChanged (int) |
Signal changed values. | |
void | valueChanged (bool) |
Signal changed values. | |
void | valueChanged (double) |
Signal changed values. | |
void | valueChanged (QString) |
Signal changed values. | |
void | valueChanged (QUrl) |
Signal changed values. | |
Public Member Functions | |
NamedParameterTreeItem (QString n, QVariant v, QTreeItem *p) | |
Creates a new named parameter with value v. | |
NamedParameterTreeItem (QString n, QVariant::Type t, QTreeItem *p) | |
Creates a new named parameter with type t. | |
NamedParameterTreeItem (NamedParameterTreeItem &item, QTreeItem *p) | |
Copy a NamedParameterTreeItem and possibly its childs into another tree. | |
~NamedParameterTreeItem () | |
destructor | |
QVariant::Type | type () const |
Returns the type. | |
QString | typeName () const |
Returns the type as string. | |
QVariant | value () const |
Returns the value. | |
QVariant | min () const |
Returns the minimum allowed. | |
QVariant | max () const |
Returns the maximum allowed. | |
int | guiHint () const |
Returns the guiHint. | |
void | setGuiHint (int n) |
Set the guiHint. | |
operator QVariant () | |
Converts this to a QVariant. | |
NamedParameterTreeItem * | getParameter (QString path) |
access child parameters | |
void | addParameter (QString path, QVariant value, QString tooltip=0) |
adds a new Parameter as child | |
void | addParameter (QString path, QVariant::Type type, QString tooltip=0) |
adds a new Parameter as child | |
QVariant | guiValue () const |
GUI: return a/the value to display. | |
void | guiSetValue (QVariant v) |
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. | |
void | setUrlFilter (const QString &filter) |
QString | urlFilter () const |
int | toInt () const |
Simplify the access. | |
bool | toBool () const |
Simplify the access. | |
double | toDouble () const |
Simplify the access. | |
QString | toString () const |
Simplify the access. | |
QUrl | toUrl () const |
Simplify the access. | |
Properties | |
GuiHint | guiHint |
Hints for the GUI to display the parameter the right way. | |
QVariant | value |
The value of this parameter. | |
QVariant | minimum |
The minimum value. | |
QVariant | maximum |
The maximum value. | |
QString | typeName |
The type as QString. | |
QString | urlFilter |
The filter for Urls. | |
Private Slots | |
void | unlockUpdate () |
Private Member Functions | |
QString | debug () const |
Custom debug text. | |
bool | needsToSaveToXml () |
Whether this item needs to be saved or not. | |
QDomNode | saveToXML (QDomDocument) |
Store the information of this element into a new QDomElement. | |
bool | restoreFromXML (QDomNode) |
Restore the state of this element from the given QDomNode. | |
NamedParameterTreeItem (const NamedParameterTreeItem &) | |
masked copy-constructor | |
Private Attributes | |
QVariant | _value |
QVariant | _min |
QVariant | _max |
bool | _inupdate |
int | _guihint |
QString | _urlfilter |
This class manages Parameters in an QTreeItem structure.
Hint-types for the GUI.
NSCore::NamedParameterTreeItem::NamedParameterTreeItem | ( | QString | n, | |
QVariant | v, | |||
QTreeItem * | p | |||
) |
Creates a new named parameter with value v.
n | the name of this parameter | |
v | the value of this parameter, the type is determined from this | |
p | the parent NamedParameterTreeItem |
NSCore::NamedParameterTreeItem::NamedParameterTreeItem | ( | QString | n, | |
QVariant::Type | t, | |||
QTreeItem * | p | |||
) |
Creates a new named parameter with type t.
n | the name of this parameter | |
t | the type of this parameter | |
p | the parent NamedParameterTreeItem |
NSCore::NamedParameterTreeItem::NamedParameterTreeItem | ( | NamedParameterTreeItem & | item, | |
QTreeItem * | p | |||
) |
Copy a NamedParameterTreeItem and possibly its childs into another tree.
Childs are only copied if they are also NamedParameterTreeItems...
item | The item that is to be copied | |
p | The parent of the new item |
NSCore::NamedParameterTreeItem::~NamedParameterTreeItem | ( | ) |
destructor
NSCore::NamedParameterTreeItem::NamedParameterTreeItem | ( | const NamedParameterTreeItem & | ) | [inline, private] |
masked copy-constructor
has to be private since the new parent needs to be known
QVariant::Type NSCore::NamedParameterTreeItem::type | ( | ) | const [inline] |
QString NSCore::NamedParameterTreeItem::typeName | ( | ) | const [inline] |
QVariant NSCore::NamedParameterTreeItem::value | ( | ) | const [inline] |
QVariant NSCore::NamedParameterTreeItem::min | ( | ) | const [inline] |
QVariant NSCore::NamedParameterTreeItem::max | ( | ) | const [inline] |
int NSCore::NamedParameterTreeItem::guiHint | ( | ) | const [inline] |
void NSCore::NamedParameterTreeItem::setGuiHint | ( | int | n | ) | [inline] |
NSCore::NamedParameterTreeItem::operator QVariant | ( | ) | [inline] |
int NSCore::NamedParameterTreeItem::toInt | ( | ) | const [inline] |
Simplify the access.
References _value.
Referenced by NSCore::GaussProducer::generateNDataSets(), and NSAcqiris::DigitizerThread::run().
bool NSCore::NamedParameterTreeItem::toBool | ( | ) | const [inline] |
double NSCore::NamedParameterTreeItem::toDouble | ( | ) | const [inline] |
QString NSCore::NamedParameterTreeItem::toString | ( | ) | const [inline] |
QUrl NSCore::NamedParameterTreeItem::toUrl | ( | ) | const [inline] |
NamedParameterTreeItem* NSCore::NamedParameterTreeItem::getParameter | ( | QString | path | ) |
access child parameters
This function returns Parameters by path ( if they exist ).
path | The path to the parameter |
Referenced by NSAcqiris::DigitizerThread::configureChannel(), NSAcqiris::DigitizerThread::DigitizerThread(), NSEvaluation::FilterItem::FilterItem(), NSEvaluation::ModifierItem::ModifierItem(), NSEvaluation::FilterItem::process(), NSEvaluation::ModifierItem::process(), NSAcqiris::DigitizerThread::run(), NSAcqiris::DigitizerThread::triggerLevelExtern(), and NSAcqiris::DigitizerThread::triggerLevelIntern().
void NSCore::NamedParameterTreeItem::addParameter | ( | QString | path, | |
QVariant | value, | |||
QString | tooltip = 0 | |||
) |
adds a new Parameter as child
path | The path to the new item. | |
value | The initial value of the new item. | |
tooltip | A string to be shown as tooltip in GUIs. |
Referenced by NSAcqiris::DigitizerThread::DigitizerThread(), NSEvaluation::FilterItem::FilterItem(), and NSEvaluation::ModifierItem::ModifierItem().
void NSCore::NamedParameterTreeItem::addParameter | ( | QString | path, | |
QVariant::Type | type, | |||
QString | tooltip = 0 | |||
) |
adds a new Parameter as child
path | The path to the new item. | |
type | The initial type of the new item. | |
tooltip | A string to be shown as tooltip in GUIs. |
QVariant NSCore::NamedParameterTreeItem::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.
References value().
void NSCore::NamedParameterTreeItem::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.
References setValue().
Qt::ItemFlags NSCore::NamedParameterTreeItem::guiFlags | ( | ) | const [virtual] |
QStringList NSCore::NamedParameterTreeItem::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::NamedParameterTreeItem::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::NamedParameterTreeItem::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.
void NSCore::NamedParameterTreeItem::setUrlFilter | ( | const QString & | filter | ) | [inline] |
References _urlfilter.
QString NSCore::NamedParameterTreeItem::urlFilter | ( | ) | const [inline] |
References _urlfilter.
void NSCore::NamedParameterTreeItem::setValue | ( | QVariant | ) | [slot] |
Set the value.
Sets the value of the option. If the type doesn't match, nothing is done. If the value exceeds min/max, the respective value is set.
This slot is protected against recursions with signals/slots. You can savely connect valueChanged( QVariant ) with setValue( QVariant ).
Referenced by guiSetValue(), and NSAcqiris::DigitizerThread::run().
void NSCore::NamedParameterTreeItem::setValue | ( | int | ) | [slot] |
Set the value.
This function is for convenience and behaves like setValue(QVariant)
void NSCore::NamedParameterTreeItem::setValue | ( | bool | ) | [slot] |
Set the value.
This function is for convenience and behaves like setValue(QVariant)
void NSCore::NamedParameterTreeItem::setValue | ( | double | ) | [slot] |
Set the value.
This function is for convenience and behaves like setValue(QVariant)
void NSCore::NamedParameterTreeItem::setValue | ( | QString | ) | [slot] |
Set the value.
This function is for convenience and behaves like setValue(QVariant)
void NSCore::NamedParameterTreeItem::setValue | ( | QUrl | ) | [slot] |
Set the value.
This function is for convenience and behaves like setValue(QVariant)
void NSCore::NamedParameterTreeItem::setMin | ( | QVariant | ) | [slot] |
void NSCore::NamedParameterTreeItem::setMax | ( | QVariant | ) | [slot] |
void NSCore::NamedParameterTreeItem::setRange | ( | QVariant | min, | |
QVariant | max | |||
) | [inline, slot] |
Sets min and max.
References setMax(), and setMin().
Referenced by NSAcqiris::DigitizerThread::DigitizerThread().
void NSCore::NamedParameterTreeItem::reset | ( | ) | [slot] |
Reset the value to the default.
void NSCore::NamedParameterTreeItem::valueChanged | ( | ) | [signal] |
Signal changed values.
These signals are emitted when the data of the option is changed.
valueChanged() and valueChanged( QVariant ) are emitted always, the others only if the type is compatible
void NSCore::NamedParameterTreeItem::valueChanged | ( | QVariant | ) | [signal] |
Signal changed values.
These signals are emitted when the data of the option is changed.
valueChanged() and valueChanged( QVariant ) are emitted always, the others only if the type is compatible
void NSCore::NamedParameterTreeItem::valueChanged | ( | int | ) | [signal] |
Signal changed values.
These signals are emitted when the data of the option is changed.
valueChanged() and valueChanged( QVariant ) are emitted always, the others only if the type is compatible
void NSCore::NamedParameterTreeItem::valueChanged | ( | bool | ) | [signal] |
Signal changed values.
These signals are emitted when the data of the option is changed.
valueChanged() and valueChanged( QVariant ) are emitted always, the others only if the type is compatible
void NSCore::NamedParameterTreeItem::valueChanged | ( | double | ) | [signal] |
Signal changed values.
These signals are emitted when the data of the option is changed.
valueChanged() and valueChanged( QVariant ) are emitted always, the others only if the type is compatible
void NSCore::NamedParameterTreeItem::valueChanged | ( | QString | ) | [signal] |
Signal changed values.
These signals are emitted when the data of the option is changed.
valueChanged() and valueChanged( QVariant ) are emitted always, the others only if the type is compatible
void NSCore::NamedParameterTreeItem::valueChanged | ( | QUrl | ) | [signal] |
Signal changed values.
These signals are emitted when the data of the option is changed.
valueChanged() and valueChanged( QVariant ) are emitted always, the others only if the type is compatible
void NSCore::NamedParameterTreeItem::unlockUpdate | ( | ) | [private, slot] |
QString NSCore::NamedParameterTreeItem::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.
References toString(), and type().
bool NSCore::NamedParameterTreeItem::needsToSaveToXml | ( | ) | [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.
QDomNode NSCore::NamedParameterTreeItem::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::NamedParameterTreeItem::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.
QVariant NSCore::NamedParameterTreeItem::_value [private] |
Referenced by toBool(), toDouble(), toInt(), toString(), toUrl(), type(), typeName(), and value().
QVariant NSCore::NamedParameterTreeItem::_min [private] |
Referenced by min().
QVariant NSCore::NamedParameterTreeItem::_max [private] |
Referenced by max().
int NSCore::NamedParameterTreeItem::_guihint [private] |
Referenced by guiHint(), and setGuiHint().
QString NSCore::NamedParameterTreeItem::_urlfilter [private] |
Referenced by setUrlFilter(), and urlFilter().
GuiHint NSCore::NamedParameterTreeItem::guiHint [read, write] |
Hints for the GUI to display the parameter the right way.
Several hints can be given via this property.
Read with guiHint(), set with setGuiHint().
QVariant NSCore::NamedParameterTreeItem::value [read, write] |
The value of this parameter.
Probably the most important property...
QVariant NSCore::NamedParameterTreeItem::minimum [read, write] |
The minimum value.
QVariant NSCore::NamedParameterTreeItem::maximum [read, write] |
The maximum value.
QString NSCore::NamedParameterTreeItem::typeName [read] |
The type as QString.
QString NSCore::NamedParameterTreeItem::urlFilter [read, write] |
The filter for Urls.