ChatCrawlersearch across public Telegram Open the app
Q

Qt for Python (PySide/Shiboken)

1 July 2021
2021-07-01×
1 July 2021
C
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)
C
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 )
K
Sounds like it is useful specifically to indicate the type for connection to/from QML.
Calendar: July 2021
Archive by month
Open in Telegram Каталог площадок Искать в ChatCrawler

A snapshot of an open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · What we do not do · Remove a page · Catalog