Qt.py icon indicating copy to clipboard operation
Qt.py copied to clipboard

stubs missing signal.connect, disconnect and emit

Open p0las opened this issue 7 months ago • 5 comments

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: image

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'

p0las avatar Nov 15 '23 23:11 p0las