Qt.py
Qt.py copied to clipboard
stubs missing signal.connect, disconnect and emit
here is a minimalistic example:
from Qt import QtWidgets, QtCore
class Foo(QtWidgets.QWidget):
my_signal = QtCore.Signal()
def __init__(self, parent=None):
super(Foo, self).__init__(parent)
self.my_signal.connect(self.doSomething)
self.my_signal.emit()
def doSomething(self):
print("signal emitted")
app = QtWidgets.QApplication([])
f = Foo()
app.exec_()
and what I get in pycharm:
pycharm is not able to resolve SignaInstance stubs and is looking for the definition in the Signal stub. I'm not sure if this is pycharm issue but I also do not understand why we need two stubs for the same class. Shouldn't we merge SignalInstance stub to Signal? is there any other way to get pycharm to resolve it? I'm getting a lot of false positives in the IDE.
Warning:(88, 17) Unresolved attribute reference 'connect' for class 'Signal'
Warning:(107, 64) Unresolved attribute reference 'emit' for class 'Signal'