summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-04-12 16:06:35 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-04-12 16:06:35 (GMT)
commit163a4a4c38453cd4ed32c5a436763e11ce580687 (patch)
treec9162f4b47571300ea17578401122532139561e9 /doc
parent7190c7be34fe0dbcfbb10b232b40977c758d251a (diff)
parentb6f1dd4151c5bbcb7d4367ec972c9026ab9e68be (diff)
downloadQt-163a4a4c38453cd4ed32c5a436763e11ce580687.zip
Qt-163a4a4c38453cd4ed32c5a436763e11ce580687.tar.gz
Qt-163a4a4c38453cd4ed32c5a436763e11ce580687.tar.bz2
Merge branch 4.7 into qt-master-from-4.7
Diffstat (limited to 'doc')
-rw-r--r--doc/src/declarative/qtbinding.qdoc19
-rw-r--r--doc/src/snippets/declarative/qtbinding/enums/standalone.qml15
2 files changed, 34 insertions, 0 deletions
diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc
index d11825e..3659caa 100644
--- a/doc/src/declarative/qtbinding.qdoc
+++ b/doc/src/declarative/qtbinding.qdoc
@@ -368,6 +368,10 @@ instead to create the signal handler:
\o \snippet doc/src/snippets/declarative/qtbinding/signals-cpp/MyItem.qml 0
\endtable
+C++ signals can use enum values as parameters provided that the enum is declared in the
+class that is emitting the signal, and that the enum is registered using Q_ENUMS.
+See \l {Using enumerations of a custom type} below for details.
+
\section2 Modifying properties
@@ -503,6 +507,21 @@ the \l {Extending QML Functionalities using C++} reference documentation for
more information.
+\section2 Using enumeration values as signal parameters
+
+C++ signals may pass enumeration values as signal parameters to QML, providing that the enumeration
+and the signal are declared within the same class, or that the enumeration value is one of those declared
+in the \l {Qt}{Qt Namespace}.
+
+Additionally, if a C++ signal with an enum parameter should be connectable to a QML function using the
+\l {Connecting signals to methods and other signals}{connect()} function, the enum type must be
+registered using qRegisterMetaType().
+
+For QML signals, enum values may be used as signal parameters using the \c int type:
+
+\snippet doc/src/snippets/declarative/qtbinding/enums/standalone.qml 1
+
+
\section2 Automatic type conversion from strings
As a convenience, some basic types can be specified in QML using format strings to make it easier to
diff --git a/doc/src/snippets/declarative/qtbinding/enums/standalone.qml b/doc/src/snippets/declarative/qtbinding/enums/standalone.qml
index 5721870..74e2c9c 100644
--- a/doc/src/snippets/declarative/qtbinding/enums/standalone.qml
+++ b/doc/src/snippets/declarative/qtbinding/enums/standalone.qml
@@ -38,6 +38,9 @@
**
****************************************************************************/
import MyLibrary 1.0
+import QtQuick 1.0
+
+Item {
//![0]
ImageViewer {
@@ -47,3 +50,15 @@ ImageViewer {
}
}
//![0]
+
+//![1]
+ImageViewer {
+ signal someOtherSignal(int statusValue)
+
+ Component.onCompleted: {
+ someOtherSignal(ImageViewer.Loading)
+ }
+}
+//![1]
+
+}