MeVisLab Scripting Reference
MLABEnumField Class Reference
Inheritance diagram for MLABEnumField:
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 &val)
 
void updateValue (const QString &val)
 
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)
 
void disconnectUndoable ()
 
void disconnectOutputsUndoable ()
 
void disconnectAllUndoable ()
 
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 int value, a item and a user interface title Only the item string is saved to a file. Thus items should only be renamed/removed when 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 not get 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.

◆ 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 not get problems with non-existing enums.

◆ 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 item name.

◆ 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 int value and deprecatedNames.

◆ intValue

int MLABEnumField::intValue ( ) const
slot

deprecated: returns the int enum value

Warning
don't use!

◆ isCurrentItem

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

Returns if 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

deprecated: sets the int enum value

Warning
don't use!

◆ setStringValue()

void MLABEnumField::setStringValue ( const QString &  )
overridevirtual

Sets the value of the field as a string value.

Reimplemented from MLABField.

◆ setTitleForItem

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

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

◆ setValue

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

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

◆ 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.

◆ updateValue

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

Sets the string value if different from the current value.

◆ valueChanged

void MLABEnumField::valueChanged ( )
signal

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