diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-08-25 14:10:02 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-08-25 13:54:11 +0000 |
commit | 247c14cf39f61365f9cadd5efdd36d42616e0b60 (patch) | |
tree | cc5920eec9574983c838ee08a706c6f75ae313ad | |
parent | 0175fcf3640228f96a9e51c8ab40cb899760507f (diff) |
Documentation/Signal slot tutorial: Recommend to use @Slot always
Task-number: PYSIDE-463
Task-number: PYSIDE-2436
Change-Id: Ida83a0b4207ab499cfaaa2090f8aabbc6246bff5
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit f762506f956e06514a3188fc6dab0846c94496e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/pyside6/doc/tutorials/basictutorial/signals_and_slots.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/sources/pyside6/doc/tutorials/basictutorial/signals_and_slots.rst b/sources/pyside6/doc/tutorials/basictutorial/signals_and_slots.rst index d02a6d9ff..702882ffb 100644 --- a/sources/pyside6/doc/tutorials/basictutorial/signals_and_slots.rst +++ b/sources/pyside6/doc/tutorials/basictutorial/signals_and_slots.rst @@ -159,6 +159,19 @@ Python type. The ``name`` keyword behaves the same way as in ``Signal()``. If nothing is passed as name then the new slot will have the same name as the function that is being decorated. +We recommend marking all methods used by signal connections with a +``@QtCore.Slot()`` decorator. Not doing causes run-time overhead due to the +method being added to the ``QMetaObject`` when creating the connection. This is +particularly important for ``QObject`` classes registered with QML, where +missing decorators can introduce bugs. + +Missing decorators can be diagnosed by setting activating warnings of the +logging category ``qt.pyside.libpyside``; for example by setting the +environment variable: + +.. code-block:: bash + + export QT_LOGGING_RULES="qt.pyside.libpyside.warning=true" .. _overloading-signals-and-slots: |