forked from qt-creator/qt-creator
The label name was changed, but the doc was not fixed. Change-Id: I585db2824837f1b076133306d3af5276bcdaae28 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
123 lines
4.0 KiB
Plaintext
123 lines
4.0 KiB
Plaintext
/****************************************************************************
|
|
**
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
** Contact: https://www.qt.io/licensing/
|
|
**
|
|
** This file is part of the Qt Creator documentation.
|
|
**
|
|
** Commercial License Usage
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
** accordance with the commercial license agreement provided with the
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
**
|
|
** GNU Free Documentation License Usage
|
|
** Alternatively, this file may be used under the terms of the GNU Free
|
|
** Documentation License version 1.3 as published by the Free Software
|
|
** Foundation and appearing in the file included in the packaging of
|
|
** this file. Please review the following information to ensure
|
|
** the GNU Free Documentation License version 1.3 requirements
|
|
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
|
|
**
|
|
****************************************************************************/
|
|
|
|
/*!
|
|
\contentspage {Qt Creator Manual}
|
|
\previouspage qmldesigner-pathview-editor.html
|
|
\page qmldesigner-connections.html
|
|
\nextpage quick-components.html
|
|
|
|
\title Adding Connections
|
|
|
|
You can use the \uicontrol {Connections} view to:
|
|
|
|
\list
|
|
|
|
\li Connect objects to signals.
|
|
|
|
\li Specify dynamic properties for objects.
|
|
|
|
\li Create bindings between the properties of two objects.
|
|
|
|
\endlist
|
|
|
|
For examples of adding connections, see
|
|
\l{Creating Scalable Buttons and Borders}.
|
|
|
|
\section1 Connecting Objects to Signals
|
|
|
|
To connect objects to signals in QML, create \l{Connections} objects.
|
|
|
|
\image qmldesigner-connections.png
|
|
|
|
To create the connections:
|
|
|
|
\list 1
|
|
|
|
\li Select the \uicontrol {Connections} tab.
|
|
|
|
\li Select \uicontrol Target to add the object to connect to a signal.
|
|
|
|
\li Select \uicontrol {Signal Handler} to select the signal that the connection
|
|
will listen to from a list of all signals available for the object.
|
|
|
|
\li Select \uicontrol Actions to specify the action to perform when
|
|
the signal is emitted. You use JavaScript to specify the actions.
|
|
|
|
\endlist
|
|
|
|
\section1 Specifying Dynamic Properties
|
|
|
|
You can bind \l{Properties} to dynamic expressions to define global properties for an
|
|
object that can be read by other objects. For example, you can specify
|
|
global properties for the root object that you can use in the child objects.
|
|
|
|
\image qmldesigner-dynamicprops.png
|
|
|
|
To specify dynamic properties for an object:
|
|
|
|
\list 1
|
|
|
|
\li Select the \uicontrol {Properties} tab.
|
|
|
|
\li Select \uicontrol Item to select the object to specify the property for.
|
|
|
|
\li Select \uicontrol Property to give a name to the property.
|
|
|
|
\li Select \uicontrol {Property Type} to specify the type of the property.
|
|
|
|
\li Select \uicontrol {Property Value} to specify the value of the property.
|
|
|
|
\endlist
|
|
|
|
\section1 Adding Bindings Between Properties
|
|
|
|
To dynamically change the behavior of an object, you can create a
|
|
\l{Property Binding} between the properties of two objects.
|
|
|
|
\image qmldesigner-bindings.png
|
|
|
|
To bind a property of an object to the property of another object:
|
|
|
|
\list 1
|
|
|
|
\li Select the \uicontrol {Bindings} tab.
|
|
|
|
\li Select \uicontrol Item to select the target object whose property you want
|
|
to change dynamically.
|
|
|
|
\li Select \uicontrol Property to specify the property to bind to a source
|
|
property.
|
|
|
|
\li Select \uicontrol {Source Item} to specify the object whose property you
|
|
want to use to determine the behavior of the target object.
|
|
|
|
\li Select \uicontrol {Source Property} to specify the property to bind the
|
|
target property to.
|
|
|
|
\endlist
|
|
|
|
*/
|