QML Connections ElementA Connections element describes generalized connections to signals. More... This element was introduced in Qt 4.7. Properties
Detailed DescriptionA Connections object creates a connection to a QML signal. When connecting to signals in QML, the usual way is to create an "on<Signal>" handler that reacts when a signal is received, like this: MouseArea { onClicked: { foo(parameters) } } However, it is not possible to connect to a signal in this way in some cases, such as when:
When any of these are needed, the Connections element can be used instead. For example, the above code can be changed to use a Connections object, like this: MouseArea { Connections { onClicked: foo(parameters) } } More generally, the Connections object can be a child of some object other than the sender of the signal: MouseArea { id: area } // ... Connections { target: area onClicked: foo(parameters) } See also QtDeclarative. Property DocumentationNormally, a connection to a non-existent signal produces runtime errors. If this property is set to true, such errors are ignored. This is useful if you intend to connect to different types of objects, handling a different set of signals for each object. This property holds the object that sends the signal. If this property is not set, the target defaults to the parent of the Connection. If set to null, no connection is made and any signal handlers are ignored until the target is not null. © 2008-2011 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. Privacy Policy Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia. Alternatively, this document may be used under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. |