From 1c5a7ebcde782739cfe02e56a65d274e32bd14fa Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 13 Aug 2021 18:03:05 +0200 Subject: 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 Reviewed-by: Maximilian Goldstein Reviewed-by: Andrei Golubev --- .../data/generalizedGroupedProperty.qml | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/auto/qml/qqmllanguage/data/generalizedGroupedProperty.qml (limited to 'tests/auto/qml/qqmllanguage/data/generalizedGroupedProperty.qml') 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" + } +} -- cgit v1.2.3