Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. When Use @Slot(), sender has NoneType.

When Use @Slot(), sender has NoneType.

Scheduled Pinned Locked Moved Solved Qt for Python
2 Posts 2 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    klyjm
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      klyjm
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved