Signal and Slot

Heads up! You've already completed this tutorial.

Scoodood | 2020-08-06 18:18:52 UTC | #1

Dear Martin,

I am just done watching the Signal, Slots & Events video and done reading the Signals and Slots chapter on your PySide2 ebook. The sample code below is from your video

python
self.windowTitleChanged.connect(self.onWindowTitleChange)

def onWindowTitleChange(self, s):   # <--- "s" ??
   print(s)

How do you know that the signal is also passing along a string variable s in this case? There are so many type of signals in Qt (pressed, released, drag, move....etc), how do we know each signal is passing along what-else when it is triggered? How do we find out?

Thanks


Impiastro_1 | 2020-08-07 15:59:20 UTC | #2

[quote="Scoodood, post:1, topic:394"] How do you know that the signal is also passing along a string variable s in this case? There are so many type of signals in Qt (pressed, released, drag, move…etc), how do we know each signal is passing along what-else when it is triggered? How do we find out? [/quote]

You can find your answers here: https://doc.qt.io/qtforpython/PySide2/QtGui/QWindow.html?highlight=windowtitlechanged#PySide2.QtGui.PySide2.QtGui.QWindow.windowTitleChanged

I think that in this case the signal emits only one unicode parameter.

ROb


Over 10,000 developers have bought Create GUI Applications with Python & Qt!

To support developers in [[ countryRegion ]] I give a [[ localizedDiscount[couponCode] ]]% discount with the code [[ couponCode ]] — Enjoy!

For [[ activeDiscount.description ]] I'm giving a [[ activeDiscount.discount ]]% discount with the code [[ couponCode ]] — Enjoy!

Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak