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

Christian Tismer-Sperling tismer at stackless.com
Sat Nov 19 17:54:39 CET 2022


On 18.11.22 20:27, icfwm at gmx.net wrote:
> Hello Chris and others,
> 
> thanks for the insights. To be honest, I don't completely understand the
> issues I might be facing when not using @Slot decorators. Furthermore, I
> fear that there are a lot of code lines in my project which do not use
> the decorator... (and it seems to work without any issues).
>> There is only one safe way to create reliable signals and slots.
>> Use the decorator!
> 
> If this statement is actually true, I'm starting to wonder why using
> non-decorated python functions is at all possible in signal/slot
> connections? Shouldn't there at least be a qWarning or a python warning
> in these situations?
> 
> Kind Regards
> 
> Christoph
> 
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> https://lists.qt-project.org/listinfo/pyside

It makes little sense to continue this conversation if you don't
trust my statements or I cannot explain the facts.

On the positive side: The problem is meanwhile gone for Qt 6.4
because the Qt people solved that sorting problem, lately.

Otherwise, you would get a warning that there is wrong ordering.
This was seen in https://bugreports.qt.io/browse/PYSIDE-2033 where
they used PySide 6.3.1 and got the warning

"""Signals and slots in QMetaObject 'SubclassObject' are not ordered 
correctly, this may lead to issues."""

This warning does not happen in 6.4, which means the sorting is ok now.

Solution for PySide
   6.3: Use decorators to be safe, but you get a warning if wrong.
   6.4: Problem gone. You should use the decorator for other reasons.

-- 
Christian Tismer-Sperling    :^)   tismer at stackless.com
Software Consulting          :     http://www.stackless.com/
Strandstraße 37              :     https://github.com/PySide
24217 Schönberg              :     GPG key -> 0xFB7BEE0E
phone +49 173 24 18 776  fax +49 (30) 700143-0023



More information about the PySide mailing list