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

Cristián Maureira-Fredes Cristian.Maureira-Fredes at qt.io
Wed Nov 16 10:55:42 CET 2022


Hello,

The answer can be found in
https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/pyside6/libpyside/dynamicqmetaobject.cpp#n557

The main idea is to register Slots (and signals) at parsing time,
before the connection is done.

An old issue can be find here:
https://bugreports.qt.io/browse/PYSIDE-315
with some discussion as well.

I hope that helps,
Cheers

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
--


More information about the PySide mailing list