1.. currentmodule:: PySide2.QtCore
2.. _Slot:
3
4Slot
5****
6
7Detailed Description
8--------------------
9
10    PySide2 adopt PyQt5's new signal and slot syntax as-is. The PySide2
11    implementation is functionally compatible with the PyQt5 one, with the
12    exceptions listed below.
13
14    PyQt5's new signal and slot style utilizes method and decorator names
15    specific to their implementation. These will be generalized according to
16    the table below:
17
18    =======  =======================  =============
19    Module   PyQt5 factory function   PySide2 class
20    =======  =======================  =============
21    QtCore   pyqtSignal               Signal
22    QtCore   pyqtSlot                 Slot
23    =======  =======================  =============
24
25Q_INVOKABLE
26-----------
27
28    There is no equivalent of the Q_INVOKABLE macro of Qt
29    since PySide2 slots can actually have return values.
30    If you need to create a invokable method that returns some value,
31    declare it as a slot, e.g.:
32
33    ::
34
35        class Foo(QObject):
36
37            @Slot(float, result=int)
38            def getFloatReturnInt(self, f):
39                return int(f)
40