aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-02-06 17:01:45 +0100
committerUlf Hermann <ulf.hermann@qt.io>2024-02-13 20:04:59 +0100
commit03ac6a0990afeb0ea3294e22d6e553a4370f32eb (patch)
treece409137447eb2ceca40174b0f518dcbee5c221b /src/qml/doc
parente878b00efb84e8ea63015bd6727864228973b7b4 (diff)
QtQml: Re-allow manual calling of signal handlers
The fact that you could do this was due to a mistake in the implementation of QQmlPropertyCache. The cache entry for the signal handler looked like the signal itself. Make it possible to call QmlSignalHandler objects, and output a categorized warning when doing so. Also, align the call code between the interpreter and the JIT. Pick-to: 6.7 Fixes: QTBUG-120573 Change-Id: Ic76d37f587d21b68c55d77a08ac2d30950bec133 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Yifan Zhu <fanzhuyifan@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/qml/doc')
-rw-r--r--src/qml/doc/src/qmllanguageref/syntax/signals.qdoc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
index 32a61d2ebf..b40181b49c 100644
--- a/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
+++ b/src/qml/doc/src/qmllanguageref/syntax/signals.qdoc
@@ -54,6 +54,13 @@ Rectangle {
}
\endqml
+\note Even though signal handlers look a bit like JavaScript functions, you
+ should not call them directly. If you need to share code between signal
+ handlers and other functionality, refactor it into a separate function.
+ Otherwise always emit the signal if you want the signal handler to be
+ called. There can be multiple handlers, in different scopes, for the
+ same signal.
+
\section2 Property change signal handlers
A signal is automatically emitted when the value of a QML property changes.