aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 07a570e0fa..ce4a8770de 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -219,16 +219,22 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
QV4::Scope scope(v4);
- // ### This should be resolved earlier at compile time and the binding value should be changed accordingly.
- if (property->isEnum() && !(binding->flags & QV4::CompiledData::Binding::IsResolvedEnum)) {
- QVariant value = binding->valueAsString(&qmlUnit->header);
- bool ok = QQmlPropertyPrivate::write(_qobject, *property, value, context);
- Q_ASSERT(ok);
- Q_UNUSED(ok);
- return;
+ int propertyType = property->propType;
+
+ if (property->isEnum()) {
+ if (binding->flags & QV4::CompiledData::Binding::IsResolvedEnum) {
+ propertyType = QMetaType::Int;
+ } else {
+ // ### This should be resolved earlier at compile time and the binding value should be changed accordingly.
+ QVariant value = binding->valueAsString(&qmlUnit->header);
+ bool ok = QQmlPropertyPrivate::write(_qobject, *property, value, context);
+ Q_ASSERT(ok);
+ Q_UNUSED(ok);
+ return;
+ }
}
- switch (property->propType) {
+ switch (propertyType) {
case QMetaType::QVariant: {
if (binding->type == QV4::CompiledData::Binding::Type_Number) {
double n = binding->valueAsNumber();