Results 1 to 5 of 5

Thread: Proper PyQt5 signal & slot syntax

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2019
    Posts
    12
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Proper PyQt5 signal & slot syntax

    Thank you for the response. I had also tried using an instantiated version of the class, but was still getting errors on connect.

    It turns out that the line 110 above:
    @pyqtSlot

    was causing the issue. I don't know why, but when I commented out this line everything worked! It looks like that decorator is only for non-class functions.

    Thanks!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,329
    Thanks
    317
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Proper PyQt5 signal & slot syntax

    Maybe it is my ignorance of PyQt and python in general, but where is the instance of ChangeSignals that forms the sending (signal) end of the increase() signal? I see you have defined a global variable named sig that is a ChangeSignals instance, but where is that used in the connect() statement?

    The only thing I can imagine is that ChangeSignals.increase.connect() must create a temporary instance of ChangeSignals that provides the signalling end and once __init__ exits this goes out of scope, gets destroyed, and the connection broken. Shouldn't this be "sig.increase.connect()" instead?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Oct 2019
    Posts
    12
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Proper PyQt5 signal & slot syntax

    No, you didn't miss anything. I went back to the version where I instantiated the class and used that signal, but I didn't update the code in my question. THEN I removed the pyqtSignal decorator.

    Sorry to throw you off!

  4. The following user says thank you to illuzioner1 for this useful post:

    d_stranz (3rd May 2020)

Similar Threads

  1. Replies: 0
    Last Post: 17th November 2015, 18:11
  2. PyQt4 Signal to PyQt5 Signal Convert?
    By mthnzbk in forum Qt Programming
    Replies: 3
    Last Post: 13th September 2015, 21:38
  3. Replies: 1
    Last Post: 28th February 2015, 16:20
  4. Replies: 2
    Last Post: 26th October 2013, 05:40
  5. Trouble with proper syntax for directorys
    By prophet0 in forum Newbie
    Replies: 2
    Last Post: 21st February 2012, 22:42

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.