Enum conversion utility functions.
More...
|
| int | enumToInt (const QVariant &value, const QMetaEnum &metaEnum) |
| | Converts the given enum or flag value into its numerical representation.
|
| |
| QString | enumToString (const QVariant &value, const char *typeName=nullptr, const QMetaObject *metaObject=nullptr) |
| | Translates an enum or flag value into a human readable text.
|
| |
| QMetaEnum | metaEnum (const QVariant &value, const char *typeName=nullptr, const QMetaObject *metaObject=nullptr) |
| | Determine the QMetaEnum for a given enum/flag value.
|
| |
Enum conversion utility functions.
◆ enumToInt()
| int GammaRay::EnumUtil::enumToInt |
( |
const QVariant & |
value, |
|
|
const QMetaEnum & |
metaEnum |
|
) |
| |
Converts the given enum or flag value into its numerical representation.
- Parameters
-
| value | A QVariant holding the enum/flag value, numerical or as actual enum/flag. |
| metaEnum | The QMetaEnum defining the enum/flag. |
- Since
- 2.6
◆ enumToString()
| QString GammaRay::EnumUtil::enumToString |
( |
const QVariant & |
value, |
|
|
const char * |
typeName = nullptr, |
|
|
const QMetaObject * |
metaObject = nullptr |
|
) |
| |
Translates an enum or flag value into a human readable text.
- Parameters
-
| value | The numerical value. Type information from the QVariant are used to find the corresponding QMetaEnum. |
| typeName | Use this if the value has type int (e.g. the case for QMetaProperty::read). |
| metaObject | QMetaObject possibly containing the definition of the enum. |
- Returns
- a QString containing the string version of the specified
value.
- Since
- 2.6
◆ metaEnum()
| QMetaEnum GammaRay::EnumUtil::metaEnum |
( |
const QVariant & |
value, |
|
|
const char * |
typeName = nullptr, |
|
|
const QMetaObject * |
metaObject = nullptr |
|
) |
| |
Determine the QMetaEnum for a given enum/flag value.
- Parameters
-
| value | A QVariant holding the enum/flag value, numerical or as actual enum/flag. |
| typeName | A type name hint, in case value holds a numeric value. |
| metaObject | A meta object hint holding the enum definition. |
- Since
- 2.6