diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-12 02:35:28 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-12 02:35:28 (GMT) |
commit | b6f1dd4151c5bbcb7d4367ec972c9026ab9e68be (patch) | |
tree | b9c4adba9bf64a3f8f62d1b1299f5083f3896ea2 /doc | |
parent | 4889729b32b30a4bad90a0add8ca444529dea2e7 (diff) | |
parent | f2219ce983098fc14655d8f3bb8a7fee2c9abe4d (diff) | |
download | Qt-b6f1dd4151c5bbcb7d4367ec972c9026ab9e68be.zip Qt-b6f1dd4151c5bbcb7d4367ec972c9026ab9e68be.tar.gz Qt-b6f1dd4151c5bbcb7d4367ec972c9026ab9e68be.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml:
Allow enum values to be used as signal parameters
ListModel::clear() should not clear roles
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/declarative/qtbinding.qdoc | 19 | ||||
-rw-r--r-- | doc/src/snippets/declarative/qtbinding/enums/standalone.qml | 15 |
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] + +} |