Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
6.5.3
-
None
Description
SignalInstance.connect’s typing is wrong:
def connect(self, slot: object, type: Optional[type] = ...) -> None: ...
The actual typing should look like this:
def connect(self, slot: object, type: Optional[QtCore.Qt.ConnectionType] = ...) -> None: ...
Currently, mypy fails to check this code:
button = QPushButton() button.clicked.connect( lambda: print("Button clicked"), type=Qt.ConnectionType.AutoConnection )
With this error:
error: Argument "type" to "connect" of "SignalInstance" has incompatible type "ConnectionType"; expected "type | None" [arg-type]
Attachments
Issue Links
- duplicates
-
PYSIDE-2509 Typing: connect() returns a QMetaObject.Connection object
- Closed