PyQt4.QtCore.pyqtSignal object has no attribute 'connect'

前端 未结 6 1048
别那么骄傲
别那么骄傲 2020-12-23 09:04

I\'m having issues with a custom signal in a class I made.

Relevant code:

self.parse_triggered = QtCore.pyqtSignal()

def parseFile(self):
    self.e         


        
6条回答
  •  难免孤独
    2020-12-23 09:31

    You also get that error message if you fail to call super() or QObject.__init__() in your custom class.

    A checklist for defining custom signals in a class in Qt in Python:

    • your class derives from QObject (directly or indirectly)
    • your class __init__ calls super() (or calls QObject.__init__() directly.)
    • your signal is defined as a class variable, not an instance variable
    • the signature (formal arguments) of your signal matches the signature of any slot that you will connect to the signal e.g. () or (int) or (str) or ((int,), (str,))

提交回复
热议问题