Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. PyQt4 Signal to PyQt5 Signal Convert?

PyQt4 Signal to PyQt5 Signal Convert?

Scheduled Pinned Locked Moved Language Bindings
4 Posts 3 Posters 2.6k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    mthnzbk
    wrote on last edited by
    #1

    self.emit(SIGNAL("selectedInfoChanged(int, QString, int, QString)"), packages, packagesSize, extraPackages, extraPackagesSize)
    self.emit(SIGNAL("selectedInfoChanged(QString)"), unicode(e))

    pyqt5 also how I do it? Sorry, my English is weak.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      redstoneleo9
      wrote on last edited by
      #2

      http://pyqt.sourceforge.net/Docs/PyQt5/signals_slots.html

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mthnzbk
        wrote on last edited by
        #3

        selectedInfoChanged = pyqtSignal() # ???

        Unclear how many will take the argument?

        1 Reply Last reply
        0
        • jazzycamelJ Offline
          jazzycamelJ Offline
          jazzycamel
          wrote on last edited by
          #4

          If you are trying to emit the signal selectedInfoChanged then you would do as follows:

          self.selectedInfoChanged.emit(packages, packagesSize, extraPackages, extraPackagesSize)
          

          If you are trying to declare a signal with that signature then you would do the following:

          class MyClass(QObject):
              selectedInfoChanged=pyqtSignal(int, str, int, str)
          

          Note: a signal must be a class attribute not an instance attribute and QString is not supported by PyQt5, just use python strings (PyQt5 automatically converts them to C++ QStrings).

          Hope this helps ;-)

          For the avoidance of doubt:

          1. All my code samples (C++ or Python) are tested before posting
          2. As of 23/03/20, my Python code is formatted to PEP-8 standards using black from the PSF (https://github.com/psf/black)
          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