diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-05-01 06:39:43 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-05-01 06:39:43 (GMT) |
commit | dac26313fcfc3862a7f2aeaa58bb2afe0d494ec9 (patch) | |
tree | 806d441c2864107ad9d8c32246e75af15f0ed106 /src/declarative/util/qmlconnection.cpp | |
parent | 8f52aee209aa64ef6719126547c767583870bd9f (diff) | |
download | Qt-dac26313fcfc3862a7f2aeaa58bb2afe0d494ec9.zip Qt-dac26313fcfc3862a7f2aeaa58bb2afe0d494ec9.tar.gz Qt-dac26313fcfc3862a7f2aeaa58bb2afe0d494ec9.tar.bz2 |
doc
Diffstat (limited to 'src/declarative/util/qmlconnection.cpp')
-rw-r--r-- | src/declarative/util/qmlconnection.cpp | 56 |
1 files changed, 34 insertions, 22 deletions
diff --git a/src/declarative/util/qmlconnection.cpp b/src/declarative/util/qmlconnection.cpp index 5cd4371..8f6c908 100644 --- a/src/declarative/util/qmlconnection.cpp +++ b/src/declarative/util/qmlconnection.cpp @@ -62,7 +62,7 @@ public: /*! \qmlclass Connection QmlConnection - \brief The Connection element describes generalized connections to signals. + \brief A Connection object describes generalized connections to signals. JavaScript-in-HTML style signal properties do not allow: \list @@ -73,31 +73,40 @@ public: \i signals in classes with coincidentally-named on<Signal> properties \endlist - When any of these is needed, the Connection element can be used instead. + When any of these is needed, the Connection object can be used instead. Where a signal could be connected like this: - \code - <MouseRegion onClicked="foo(x+123,y+456)" /> - \endcode + \qml +MouseRegion { + onClicked: { foo(x+123,y+456) } +} + \endqml - An equivalent binding can be made with a Connection element: + An equivalent binding can be made with a Connection object: - \code - <MouseRegion> - <Connection signal="clicked(x,y)" script="foo(x+123,y+456)" /> - </MouseRegion> - \endcode + \qml +MouseRegion { + Connection { + signal: "clicked(x,y)" + script: { foo(x+123,y+456) } + } +} + \endqml - More generally, the Connection element can be a child of some other element than + More generally, the Connection object can be a child of some other object than the sender of the signal, and the script is the default attribute: - \code - <MouseRegion id="mr"/> - ... - <Connection sender="{mr}" signal="clicked(x,y)"> - foo(x+123,y+456) - </Connection> - \endcode + \qml +MouseRegion { + id: mr +} +... +Connection { + sender: mr + signal: "clicked(x,y)" + script: { foo(x+123,y+456) } +} + \endqml */ /*! @@ -257,9 +266,12 @@ void QmlConnection::setScript(const QString& script) The signal must have its formal parameter names given in parentheses: - \code - <Connection signal="clicked(x,y)" ... /> - \endcode + \qml +Connection { + signal: "clicked(x,y)" + script: { ... } +} + \endqml */ /*! |