Qt Creator Manual | Adding Connections

Qt Creator Manual 4.9.0

Editing PathView Properties ◦ Connecting Objects to Signals

# Adding Connections

The user interface components and the application need to communicate with each other. For example, a button needs to know that the user has clicked on it. The button may then change color to indicate its state or perform an action. Further, the application needs to know whether the user is clicking the button, because it may need to relay this clicking event to other applications.

QML has a signal and handler mechanism, that enables components to respond to application events. Events are represented by signals. When a signal is emitted, the corresponding signal handler is invoked to respond to the event by using scripts or other operations placed in the handler.

To access a signal outside of the object that emits it, you can use the Connections type for connecting to signals of arbitrary objects. A Connections object can receive any signal from its specified target.

A component's property can be assigned a static value which stays constant until it is explicitly assigned a new value. However, to make the fullest use of QML and its built-in support for dynamic object behaviors, most QML types use property bindings. This means that you can specify relationships between different object properties so that when a property's sependencies change in value, the property's value is automatically updated accordingly.

Behind the scenes, the QML engine monitors the property's dependencies (that is, the variables in the binding expression). When a change is detected, the QML engine re-evaluates the binding expression and applies the new result to the property.

The following sections describe how to use the Connections view to perform the following tasks:

- Connecting Objects to Signals
- Specifying Dynamic Properties
- Adding Bindings Between Properties
- Managing C++ Backend Objects

Editing PathView Properties ◦ Connecting Objects to Signals