[PySide] What if a slot is not decorated with @Slot()?

Zhao Lee redstone-cold at 163.com
Wed Nov 16 15:18:09 CET 2022

I initially expect that the aim of the decorator @Slot() is to make things easier like this 
and without the decorator , you'd expect write a little more code like
But decorators in PySide become a little different. I know the decorator can make the signal and slot connection a bit easier in PyQt in this way
    def on_downloadedView_doubleClicked(self, index) :
But I still doubt the necessity of the decorator here if we write the slot method name in this way. I wonder if it is possible to simplify the mechanism in PySide like that in the above example of uwsgi without requiring it is mandatory(In fact as I posted in last email, it seems still ok without the decorator, although the doc states it is mandatory to exist).

At 2022-11-16 17:55:42, "Cristián Maureira-Fredes via PySide" <pyside at qt-project.org> wrote:
>The answer can be found in
>The main idea is to register Slots (and signals) at parsing time,
>before the connection is done.
>An old issue can be find here:
>with some discussion as well.
>I hope that helps,
>On 11/16/22 06:47, Zhao Lee wrote:
>> The doc says 
>> <https://doc.qt.io/qtforpython/tutorials/expenses/expenses.html?highlight=slot#adding-elements>:
>>     It is really important to decorate each method declaration with a
>>     @Slot(), in that way PySide6 knows internally how to register them
>>     into Qt.
>> But the method used as the slot works well even without the @Slot() 
>> decorator , I wonder if there is a risk in doing so.
>> _______________________________________________
>> PySide mailing list
>> PySide at qt-project.org
>> https://lists.qt-project.org/listinfo/pyside
>Dr. Cristian Maureira-Fredes
>Senior R&D Manager
>The Qt Company GmbH
>Erich-Thilo-Str. 10
>D-12489 Berlin
>Geschäftsführer: Mika Pälsi,
>Juha Varelius, Mika Harjuaho
>Sitz der Gesellschaft: Berlin,
>Registergericht: Amtsgericht
>Charlottenburg, HRB 144331 B
>PySide mailing list
>PySide at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20221116/78a7874d/attachment.htm>

More information about the PySide mailing list