Home · All Classes · All Functions · Overviews

QML Connections Element Reference

A Connections object describes generalized connections to signals. More...

Properties

Detailed Description

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(...) }
 }

However, in some cases, it is not possible to connect to a signal in this way, such as:

When any of these are needed, the Connections object can be used instead.

For example, the above code can be changed to use a Connections object, like this:

 MouseArea {
     Connections {
         onClicked: foo(...)
     }
 }

More generally, the Connections object can be a child of some other object than the sender of the signal:

 MouseArea {
     id: area
 }
 ...
 Connections {
     target: area
     onClicked: foo(...)
 }

Property Documentation

target : Object

This property holds the object that sends the signal.

By default, the target is assumed to be the parent of the Connections.



Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt 4.7.0