diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-01-10 13:08:22 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-14 17:21:08 +0100 |
commit | 8e17ab6dc6c51339e824f2f1a2cbdf445b482887 (patch) | |
tree | d954c19bab96b39c6b9bb1c6f83809a8dd3b44d5 | |
parent | bc871587b2dd603af34a629b417b79d2c8540601 (diff) |
[new compiler] Fix assignments to enums from string literal
This is the quick fix for the tests. Later we'll need a pass that resolves
this and changes the QV4::CompiledData::Binding::Type according to the
resolved value of the property.
Change-Id: I5a799873ae8fb7f716a6af22f7e67927820c2513
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 69f6386dab..e880289d9d 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -181,7 +181,13 @@ void QmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::C QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine); QV4::Scope scope(v4); - // ### enums + + // ### This should be resolved earlier at compile time and the binding value should be changed accordingly. + if (property->isEnum()) { + QVariant value = binding->valueAsString(&qmlUnit->header); + QQmlPropertyPrivate::write(_qobject, *property, value, context); + return; + } switch (property->propType) { case QMetaType::QVariant: { |