diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-02 16:47:15 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-30 12:43:23 +0000 |
commit | b65acdda3be6f71e54011b439a84235da060c1bb (patch) | |
tree | 22263e41e5abf5c5a21a7bf4684a425d09e86a5f /tests/auto/qml/qqmlpropertymap/data | |
parent | 19eca0600b907d9d31fa5c0f452d03aca0c8103d (diff) |
Fix use of Component.onCompleted scripts in QQmlPropertyMap sub-types
After commit 9333ea8649838d7e0400b0e94c8cbd4fa5d216b0 when looking up
properties such as "console" in Component.onComplete handlers of
QQmlProperty sub-types, we end up implicitly creating "console"
properties, which is not correct.
At the same time, there are use-cases (and tests such as
tst_QQmlPropertyMap::QTBUG_35233) where a binding expression accesses a
property of a property map sub-type and it doesn't exist. Then later
that property is added and we must re-evaluate that binding. That works
because the implicit property creation when reading it also results in a
property capture.
Therefore we introduce the HFH (hack from hell): Detect the use of a
QQmlPropertyMap sub-type and go back to the old lookup behavior. The
path forward should be a deprecation of QQmlPropertyMap and perhaps the
ability to define abstract interfaces in QML.
Change-Id: Ib87bc1ebae44d7b332be47f1dcb614a19334b559
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlpropertymap/data')
-rw-r--r-- | tests/auto/qml/qqmlpropertymap/data/PropertyMapSubType.qml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlpropertymap/data/PropertyMapSubType.qml b/tests/auto/qml/qqmlpropertymap/data/PropertyMapSubType.qml new file mode 100644 index 0000000000..90ff179408 --- /dev/null +++ b/tests/auto/qml/qqmlpropertymap/data/PropertyMapSubType.qml @@ -0,0 +1,9 @@ +import QtQml 2.0 +import Test 1.0 + +SimplePropertyMap { + Component.onCompleted: { + console.log("expected output") + newProperty = 42 + } +} |