summaryrefslogtreecommitdiffstats
path: root/howtos/handle_cpp_signals
diff options
context:
space:
mode:
authorVladimir Minenko <vladimir.minenko@nokia.com>2012-06-18 12:12:21 +0200
committerVenugopal Shivashankar <venugopal.shivashankar@digia.com>2013-02-08 12:30:13 +0100
commite9053ba3f559fcf8c4d2dd3b6f87cce0979d0244 (patch)
tree0e6503d0068bed7b57ba751d4c200a70e5c5e7d3 /howtos/handle_cpp_signals
parent4aa878fe08f8ed3f76cabf8a6b21603fa21fcb09 (diff)
Initial commit to add the learning-guide content
Change-Id: I5eb8ab089b46122bc6f7042e20541bf70f173447 Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Diffstat (limited to 'howtos/handle_cpp_signals')
-rw-r--r--howtos/handle_cpp_signals/index.rst38
1 files changed, 38 insertions, 0 deletions
diff --git a/howtos/handle_cpp_signals/index.rst b/howtos/handle_cpp_signals/index.rst
new file mode 100644
index 0000000..d7c62bc
--- /dev/null
+++ b/howtos/handle_cpp_signals/index.rst
@@ -0,0 +1,38 @@
+..
+ ---------------------------------------------------------------------------
+ Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+ All rights reserved.
+ This work, unless otherwise expressly stated, is licensed under a
+ Creative Commons Attribution-ShareAlike 2.5.
+ The full license document is available from
+ http://creativecommons.org/licenses/by-sa/2.5/legalcode .
+ ---------------------------------------------------------------------------
+
+How to hadle signals from a C++ Object
+======================================
+
+To Handle signals from a C++ objects in your QML code, you need to add a signal handler within the object in the QML side that refers to the signal defined in the C++ code as follows:
+
+.. code-block:: cpp
+
+ // file.cpp
+
+ class MyCppObject: public QObject
+ {
+ ...
+ signals:
+ void objectSelected(const QString& message);
+
+ }
+
+And here how to handle the signal above in QML:
+
+.. code-block:: js
+
+ // file.qml
+
+ MyObject {
+ ...
+ onObjectSelected :
+ console.log(message)
+ }