MeVisLab Scripting Reference
MLABEnumField Class Reference

#include <mlabEnumField.h>

Inherits MLABField.

Public Slots

Scripting access.
bool isCurrentItem (const QString &value)
QString titleValue ()
QString titleForItem (const QString &item)
int intValue () const
void setIntValue (int value)
void setValue (const QString &value)
void updateValue (const QString &value)
void updateStringValue (const QString &value)
QStringList items ()
QStringList info ()
QStringList deprecatedItemNames (const QString &itemName) const
QStringList deprecatedItemNames (MLABEnumItem *item) const
QVariantMap deprecatedItemNames () const
bool setTitleForItem (const QString &item, const QString &title)
void addEnumItem (const QString &item, const QString &title, int value)
void clearEnums ()
Public Slots inherited from MLABField
bool isInventorField ()
bool isMLField ()
QString getType () const
QString getName () const
virtual QString stringValue ()
virtual QString persistentStringValue ()
virtual void setPersistentStringValue (const QString &value)
QString truncatedStringValue (int maxChars=80)
virtual QString stringValueForProfiling ()
virtual void touch ()
MLABFieldOwnerowner ()
MLABFieldconnectedField ()
MLABFieldinputField ()
bool isConnected ()
bool isConnectedToFieldInSameNetwork ()
int outputCount ()
MLABFieldoutputField (int index)
QList< MLABField * > outputFields ()
bool connectFrom (MLABField *field)
void disconnect ()
void disconnectOutputs ()
void disconnectAll ()
bool connectFromUndoable (MLABField *field)
virtual bool isConnectionPossible (MLABField *field)
bool isConnectionInSameNetworkPossible (MLABField *field)
bool isInSameNetwork (MLABField *field)
virtual QString toolTipInfo ()
void setPriority (int aPriority)
int priority ()
void setProxy (bool flag)
bool isProxy ()
void setComment (const QString &comment)
QString comment ()
void setTitle (const QString &title)
QString title ()
QString fullName () const
bool isHidden ()
void setHidden (bool flag)
bool isIgnored ()
void setIgnored (bool flag)
bool isFilePath ()
void setIsFilePath (bool flag)
bool isInterfaceField ()
bool isParameterField ()
bool isInput ()
bool isOutput ()
bool isInOut ()
QString infoString ()
bool isPersistent () const
bool isEditable () const
bool triggersLoading () const
void setTriggersLoading (bool flag)

Signals

void valueChanged ()

Public Member Functions

void setStringValue (const QString &value) override

Detailed Description

A field containing an enumeration value.

The 'value' property of this field is the item string. Each entry in the enumeration has an integer value, an item ,and a user interface title. Only the item string is saved to a file. Thus items should only be renamed/removed if backwards compatibility is NOT required. Use the user interface titles to change the representation of the enums in the GUI.

# getting value:
item = ctx.field("somefield").value
# setting value:
ctx.field("somefield").value = "SomeItem"

Member Function Documentation

◆ addEnumItem

void MLABEnumField::addEnumItem ( const QString & item,
const QString & title,
int value )
slot

Adds new enum entry. Use it with care because enums are supposed to be persistent, so it can be a problem to change enum items. Typically, you should set such a field to non-persistent to avoid problems with non-existing enums.

Note
An MDL GUI element will not auto-adjust to the new item, you have to recreate the GUI control.

References MLABField::title().

◆ clearEnums

void MLABEnumField::clearEnums ( )
slot

Clears all enums. Use it with care because enums are supposed to be persistent, so it can be a problem to change enum items. Typically you should set such a field to non-persistent to avoid problems with non-existing enums.

References intValue(), and setIntValue().

◆ deprecatedItemNames [1/3]

QVariantMap MLABEnumField::deprecatedItemNames ( ) const
slot

Returns a dictionary of deprecated names of all items.

◆ deprecatedItemNames [2/3]

QStringList MLABEnumField::deprecatedItemNames ( const QString & itemName) const
slot

Returns a list of deprecated names of a certain itemName.

◆ deprecatedItemNames [3/3]

QStringList MLABEnumField::deprecatedItemNames ( MLABEnumItem * item) const
slot

Returns a list of deprecated names of a certain item.

◆ info

QStringList MLABEnumField::info ( )
slot

Returns the items that can be set via setStringValue(), their integer value, and deprecatedNames.

◆ intValue

int MLABEnumField::intValue ( ) const
slot

Referenced by clearEnums().

◆ isCurrentItem

bool MLABEnumField::isCurrentItem ( const QString & value)
slot

Returns whether the current item has the given value (or a deprecated value which maps to the same item, this will print a warning).

◆ items

QStringList MLABEnumField::items ( )
slot

Returns the items that can be set via setStringValue().

◆ setIntValue

void MLABEnumField::setIntValue ( int value)
slot

Referenced by clearEnums().

◆ setStringValue()

void MLABEnumField::setStringValue ( const QString & )
overridevirtual

Sets the value of the field as a string value.

Reimplemented from MLABField.

Referenced by setValue().

◆ setTitleForItem

bool MLABEnumField::setTitleForItem ( const QString & item,
const QString & title )
slot

Sets the title for given item (after it was already added).

References MLABField::title().

◆ setValue

void MLABEnumField::setValue ( const QString & value)
inlineslot

Sets the string value (item string, not the title string).

References setStringValue().

◆ titleForItem

QString MLABEnumField::titleForItem ( const QString & item)
slot

Returns the title for GUI for given item.

◆ titleValue

QString MLABEnumField::titleValue ( )
slot

Returns the current title for GUI.

◆ updateStringValue

void MLABEnumField::updateStringValue ( const QString & value)
slot

Sets the string value if different from the current value.

Referenced by updateValue().

◆ updateValue

void MLABEnumField::updateValue ( const QString & value)
inlineslot

Sets the string value if different from the current value.

References updateStringValue().

◆ valueChanged

void MLABEnumField::valueChanged ( )
signal

Signal that is emitted when the field's value changes.