Solved When Use @Slot(), sender has NoneType.
-
Recently, I find when I use @Slot() before a function, the sender() in function will return NoneType. And if I don't use it, everything is OK, is this a bug?
@Slot() def select_leg_button_clicked(self): self.repaint() button = self.sender()
Just like this, the button will be NoneType.
But if I don't use slot, just like:#@Slot() def select_leg_button_clicked(self): self.repaint() button = self.sender()
sender() works well. Is this a bug? Because the example for Pyside2 says we should use @Slot() to reduce some error.
-
I use connect to connect the signal and slot,.In my code, it is a radiobutton, here is my code:
self.left_button = QRadioButton('l') self.left_button.clicked.connect(self.select_leg_button_clicked)
This is also the recommended way to connect signal and slot, I think I'm using Signals/Slots. Is there any wrong?