forked from qt-creator/qt-creator
QmlDesigner: Modernize Enumeration
Save some allocations and return a view instead of a new value. If you want a value because you depend on a null terminated string you have to use toScope() and toName(). Task-number: QDS-10290 Change-Id: Ia87b8d559fc1fe9bb1992e61da0aa86c68d53535 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -437,7 +437,7 @@ QVariant ObjectNodeInstance::convertEnumToValue(const QVariant &value, const Pro
|
||||
QVariant adjustedValue;
|
||||
Enumeration enumeration = value.value<Enumeration>();
|
||||
if (metaProperty.isValid() && metaProperty.isEnumType()) {
|
||||
adjustedValue = metaProperty.enumerator().keyToValue(enumeration.name());
|
||||
adjustedValue = metaProperty.enumerator().keyToValue(enumeration.toName());
|
||||
} else {
|
||||
QQmlExpression expression(context(), object(), enumeration.toString());
|
||||
adjustedValue = expression.evaluate();
|
||||
|
||||
Reference in New Issue
Block a user