1 July 2021
Keith KyzivatWhen is the @Slot decorator necessary?
I cannot remember the exact use-case where not using a Slot decorator was a 'no-no', but the main goal is that when we register the elements on the Qt metaobject, we do register Signal, Slots and Properties first, compared to the other elements of a certain Python class (which derives from a Q* class)
Cristián 🥑I cannot remember the exact use-case where not using a Slot decorator was a 'no-no', but the main goal is that when we register the elements on the Qt metaobject, we do register Signal, Slots and Properties first, compared to the other elements of a certain Python class (which derives from a Q* cla
Ok, so using @Slot(type) will ensure that it gets registered first?
What does having it registered first get you?
Is there a concern of one element overriding another?
Keith KyzivatOk, so using @Slot(type) will ensure that it gets registered first?
What does having it registered first get you?
Is there a concern of one element overriding another?
Well, sadly I cannot recall the exact case with a plain @Slot(), but as mentioned, using it allows you to add them to the QMetaObject at type parsing time, rather than when you connect a signal to it.
(see long discussion here https://bugreports.qt.io/browse/PYSIDE-315 ), also implying hat the instance of the dynamic QMetaObject is the same as the application, there is a detail implementation that when we register the Signal-Slot connections, another instance of the QMetaObject is created.
There seems to also be a requirement for Mixin Signals.
Other perks come from the arguments,
-@Slot(type) for specification on which slot to trigger (useful for QML too)
- Some people rely on having a @Slot(name="something") then connecting a signal to something, and other arguments.
Using the @Slot decorator also helps with solutions like Nuitka ( https://bugreports.qt.io/browse/PYSIDE-1589 )
Cristián 🥑Well, sadly I cannot recall the exact case with a plain @Slot(), but as mentioned, using it allows you to add them to the QMetaObject at type parsing time, rather than when you connect a signal to it.
(see long discussion here https://bugreports.qt.io/browse/PYSIDE-315 ), also implying hat the insta
Mixin Signals ?
I'm trying to decide if it's useful to discuss the @Slot decorator in the training I am working on.
Keith KyzivatMixin Signals ?
I'm trying to decide if it's useful to discuss the @Slot decorator in the training I am working on.
Well, I'd say "Use the Slot decorator on methods to ensure it's gets properly register to the QMetaObject, and also that it provides additional arguments to be used"
Keith KyzivatMixin Signals ?
I'm trying to decide if it's useful to discuss the @Slot decorator in the training I am working on.
Related to Mixin, it's like the snippet on that issue 315, when you want to access a signal from a parent class and how to deal with those scenarios.