python - PySide Signal with Argument -
qgroupbox
has signal clicked
has optional checked
parameter. suppose i'm trying connect slot inside of class so: box.clicked.connect(self.func)
, declaration of slot must def func(self, checked)
, func
being called 1 argument. how desired behaviour of func
being called both self , optional checked
arguments?
the behaviour of signals optional default parameters differs between pyqt , pyside. in pyqt, default parameter always sent, in pyside have explicitly request it:
box.clicked[bool].connect(self.func)
this better design choice, say, pyqt behaviour can lead bugs if forget default value sent though didn't ask it. case of explicit being better implicit...
Comments
Post a Comment