diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-06-27 09:47:24 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-06-30 09:27:28 +0200 |
| commit | de4795f1a9ab597c52fb3a531e5580fe6d12f3e6 (patch) | |
| tree | a1d17dad4d40167162d815b313f93618fc1b4f3b /sources/pyside6/doc/tutorials/basictutorial | |
| parent | f489d5b9088562d1a95b66526a41ee82646e7179 (diff) | |
Add section about Thread affinity to signals_and_slots.rst
Pick-to: 6.9
Task-number: PYSIDE-3124
Change-Id: Ib795aca1a2ed75b31821a90c11ccb2bdfd08f9fc
Reviewed-by: Ece Cinucen <ece.cinucen@qt.io>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/doc/tutorials/basictutorial')
| -rw-r--r-- | sources/pyside6/doc/tutorials/basictutorial/signals_and_slots.rst | 19 |
1 files changed, 19 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 1b0d1c809..c1f56df26 100644 --- a/sources/pyside6/doc/tutorials/basictutorial/signals_and_slots.rst +++ b/sources/pyside6/doc/tutorials/basictutorial/signals_and_slots.rst @@ -187,6 +187,25 @@ environment variable: export QT_LOGGING_RULES="qt.pyside.libpyside.warning=true" +Thread affinity ++++++++++++++++ + +In a multi-threaded application, signals can be emitted from senders belonging +to a different thread than the receiver. For non-Slot type receivers, the code +is then executed in the sender's thread context. + +However, for methods of :class:`~PySide6.QtCore.QObject` derived classes +decorated with @Slot, this is usually different since they are associated with +threads (see :meth:`~PySide6.QtCore.QObject.moveToThread`). This depends on +last parameter of the :meth:`~PySide6.QtCore.QObject.connect` method which is +of type :class:`PySide6.QtCore.Qt.ConnectionType`. + +When ``Qt.ConnectionType.AutoConnection`` (default) or +``Qt.ConnectionType.QueuedConnection`` are passed, the receiver code will be +executed in the thread context of the receiver object. This is useful for +passing results from background threads into GUI classes, which need to use the +main thread. + .. _overloading-signals-and-slots: Overloading Signals and Slots with Different Types |
