diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-08-13 18:03:05 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-10-28 17:49:52 +0200 |
commit | 1c5a7ebcde782739cfe02e56a65d274e32bd14fa (patch) | |
tree | c61750ca7291fac00e3ff38feddbe790f22a651c /tests/auto/qml/qqmllanguage/data/generalizedGroupedProperty.qml | |
parent | 9b2ba45c1886ee88e856f49acb6b4e2ddb983421 (diff) |
Introduce generalized grouped properties
You can now use IDs to set up bindings on other objects than the one
currently being constructed. Such bindings are only accepted if the name
given as ID is a deferred property in the surrounding object. The best
way to achieve this is by giving ImmediatePropertyNames, as that will
make all non-immediate names deferred.
You are then expected to explicitly handle the resulting deferred
bindings, for example in componentComplete(). In order to simply apply
the bindings, you can call qmlExecuteDeferred().
Task-number: QTBUG-95117
Change-Id: Iedcf07543426f8f14c23cf53f6f3bcb186a342b0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/data/generalizedGroupedProperty.qml')
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/generalizedGroupedProperty.qml | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/generalizedGroupedProperty.qml b/tests/auto/qml/qqmllanguage/data/generalizedGroupedProperty.qml new file mode 100644 index 0000000000..83deffd684 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/generalizedGroupedProperty.qml @@ -0,0 +1,29 @@ +import QtQml +import Test + +QtObject { + id: root + objectName: "foo" + signal something() + + property QtObject child: ImmediateProperties { + id: child + objectName: "barrrrr" + root.objectName: objectName + " ..." + root.onSomething: objectName = "rabrab" + } + + property QtObject meanChild: ImmediateProperties { + child.objectName: "bar" + } + + property ImmediateProperties deferred: ImmediateProperties { + id: aaa + objectName: "holz" + root.objectName: objectName + " ..." + } + + property ImmediateProperties meanDeferred: ImmediateProperties { + aaa.objectName: "stein" + } +} |