aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2019-10-07 10:01:46 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2019-10-07 11:31:17 +0200
commit00f903f3b4cd46ddf8361876401e5405030f97f1 (patch)
tree8ba52e5e8e74557aa5313ddbc6f6fbcb444f1545 /src/qml/qml
parentdce305c4041a6ee65d486f3b31dc49c274ecdcbd (diff)
QML Binding: do not convert strings
The root cause for the issue is that QQmlObjectCreator::setPropertyValue calls QQmlStringConverters::variantFromString on strings if the property is of type QVariant. Unfortunately, this cannot be changed easily as the current behavior is explicitly documented and tested in tst_qqmllanguage, thus making it a breaking change. As a workaround, QML Binding does now take a QJSValue instead of a QVariant (making value a var property), which does not trigger the conversion path. Fixes: QTBUG-78943 Change-Id: I0b64dffdb6b84b2bab2bb85a8cb263e530c18570 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index f89608cd5d..a4270628e8 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -445,6 +445,8 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const
QV4::ScopedString s(scope, v4->newString(stringValue));
_vmeMetaObject->setVMEProperty(property->coreIndex(), s);
} else {
+ // ### Qt 6: Doing the conversion here where we don't know the eventual target type is rather strange
+ // and caused for instance QTBUG-78943
QVariant value = QQmlStringConverters::variantFromString(stringValue);
property->writeProperty(_qobject, &value, propertyWriteFlags);
}