NSCore::NamedParameterTreeItem Class Reference

Parameter in a named tree structur. More...

#include <namedparametertreeitem.h>

Inheritance diagram for NSCore::NamedParameterTreeItem:

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

Collaboration graph
[legend]

List of all members.

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.
NamedParameterTreeItemgetParameter (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


Detailed Description

Parameter in a named tree structur.

This class manages Parameters in an QTreeItem structure.

Note:
If a class lets you acces the configuration via NamedParameterTreeItem or NamedParameterTreeItemPointer, you should never delete one of the childs as this will result in very strange error!

Member Enumeration Documentation

Hint-types for the GUI.

Enumerator:
ReadAllowed  This parameter should be read only. For example for control-messages.
WriteAllowed  This parameter is write-only...
ReadWrite  The parameter is a normal read-and-write-parameter.
ProvideReset  The gui should provide a reset-button.
Counter  This parameter is a counter. It is read-only and should be resetted.
UrlRead  Url: Get a filename for read.
UrlWrite  Url: Get a filename for write.
UrlDir  Url: Get a directory name.


Constructor & Destructor Documentation

NSCore::NamedParameterTreeItem::NamedParameterTreeItem ( QString  n,
QVariant  v,
QTreeItem p 
)

Creates a new named parameter with value v.

Parameters:
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.

Parameters:
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...

Parameters:
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


Member Function Documentation

QVariant::Type NSCore::NamedParameterTreeItem::type (  )  const [inline]

Returns the type.

References _value.

Referenced by debug().

QString NSCore::NamedParameterTreeItem::typeName (  )  const [inline]

Returns the type as string.

References _value.

QVariant NSCore::NamedParameterTreeItem::value (  )  const [inline]

Returns the value.

References _value.

Referenced by guiValue(), and operator QVariant().

QVariant NSCore::NamedParameterTreeItem::min (  )  const [inline]

Returns the minimum allowed.

References _min.

QVariant NSCore::NamedParameterTreeItem::max (  )  const [inline]

Returns the maximum allowed.

References _max.

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

Returns the guiHint.

References _guihint.

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

Set the guiHint.

References _guihint.

Referenced by NSAcqiris::DigitizerThread::DigitizerThread().

NSCore::NamedParameterTreeItem::operator QVariant (  )  [inline]

Converts this to a QVariant.

References value().

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]

Simplify the access.

References _value.

double NSCore::NamedParameterTreeItem::toDouble (  )  const [inline]

Simplify the access.

References _value.

QString NSCore::NamedParameterTreeItem::toString (  )  const [inline]

Simplify the access.

References _value.

Referenced by debug().

QUrl NSCore::NamedParameterTreeItem::toUrl (  )  const [inline]

Simplify the access.

References _value.

NamedParameterTreeItem* NSCore::NamedParameterTreeItem::getParameter ( QString  path  ) 

void NSCore::NamedParameterTreeItem::addParameter ( QString  path,
QVariant  value,
QString  tooltip = 0 
)

adds a new Parameter as child

Parameters:
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

Parameters:
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]

GUI: the Flags for this item.

Reimplemented from NSCore::QTreeItem.

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.

Parameters:
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.

Parameters:
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]

Sets the minimum allowed.

Referenced by setRange().

void NSCore::NamedParameterTreeItem::setMax ( QVariant   )  [slot]

Sets the maximum allowed.

Referenced by setRange().

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().

Parameters:
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.

Parameters:
node The QDomNode to restore from

Implements NSCore::QTreeItem.


Member Data Documentation

Referenced by min().

Referenced by max().

Referenced by guiHint(), and setGuiHint().

Referenced by setUrlFilter(), and urlFilter().


Property Documentation

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.


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

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