-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
version 5.15.2.0 in pycharm didn't wok. #155
Comments
What do you mean with "XXX.clickked.XXX 's autocompletion"? Can you maybe show a screenshot or code sample? |
Here's the diff for reference. 5.14.2.2...5.15.2.0 It certainly became more complex, but also more accurate to the real stuff. Anyways, yeah, it would be helpful to see a minimal example of code showing the issue and a screenshot of the issue. old... # Support for new-style signals and slots.
class pyqtSignal: # add methods
def __init__(self, *types: typing.Any, name: str = ...) -> None: ...
def emit(self, *args: typing.Any) -> None: ...
def connect(self, slot: "PYQT_SLOT") -> None: ...
def disconnect(self, slot: "PYQT_SLOT"=None) -> None: ...
class pyqtBoundSignal:
def emit(self, *args: typing.Any) -> None: ...
# Convenient type aliases.
PYQT_SIGNAL = typing.Union[pyqtSignal, pyqtBoundSignal]
PYQT_SLOT = typing.Union[typing.Callable[..., None], pyqtBoundSignal] and new. class pyqtBoundSignal:
signal = ... # type: str
def __getitem__(self, key: object) -> "pyqtBoundSignal": ...
def emit(self, *args: typing.Any) -> None: ...
def connect(self, slot: "PYQT_SLOT") -> "QMetaObject.Connection": ...
@typing.overload
def disconnect(self) -> None: ...
@typing.overload
def disconnect(self, slot: typing.Union["PYQT_SLOT", "QMetaObject.Connection"]) -> None: ...
class pyqtSignal:
signatures = ... # type: typing.Tuple[str, ...]
def __init__(self, *types: typing.Any, name: str = ...) -> None: ...
@typing.overload
def __get__(self, instance: None, owner: typing.Type["QObject"]) -> "pyqtSignal": ...
@typing.overload
def __get__(self, instance: "QObject", owner: typing.Type["QObject"]) -> pyqtBoundSignal: ...
# Convenient type aliases.
PYQT_SLOT = typing.Union[typing.Callable[..., object], pyqtBoundSignal]
QObjectT = typing.TypeVar("QObjectT", bound="QObject") |
self.pushbutton.clicked.connect() 's clicked.connect() |
just like self.pushbutton.clicked.connect() |
If I rename PyCharm's builtin stubs to avoid their usage (is there a better way?) then I see the issue in Ok, I added a few more things and still have no theories. Everything I code gets completion hints for import typing
from PyQt5 import QtCore
from PyQt5 import QtWidgets
class C(QtCore.QObject):
b: QtCore.pyqtSignal = QtCore.pyqtSignal()
c: typing.ClassVar[QtCore.pyqtSignal] = QtCore.pyqtSignal()
pushbutton: QtWidgets.QPushButton
def __init__(self, parent=None):
super().__init__(parent)
self.pushbutton = QtWidgets.QPushButton()
def m(self):
self.b.connect()
self.c.connect()
self.pushbutton.clicked.con
class I(C):
pass
class D(QtCore.QObject):
c: C
i: I
def __init__(self, parent=None):
super().__init__(parent)
self.c = C()
self.i = I()
def m(self):
self.c.b.connect()
self.c.c.connect()
self.i.b.connect()
self.i.c.connect()
self.c.pushbutton.clicked.conn
self.i.pushbutton.clicked.conn
# what ctrl+left-click goes to for `.clicked
#
# class QAbstractButton(QWidget):
# <snip>
# clicked: typing.ClassVar[QtCore.pyqtSignal] |
after I upgrade to pyqt5-stubs version 5.15.2.0, the XXX.clickked.XXX 's autocompletion in pycharm(2021.1) didn"t work.But in Vscode(with pylance) it works well.Then i downgrade to pyqt5-stubds version 5.14.2.2 ,the XXX.clickked.XXX 's autocompletion in pycharm(2021.1) starts working.
The text was updated successfully, but these errors were encountered: