-
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
QMessageBox.StandardButtons.__init__
issues
#128
Comments
I guess that issue exists in various places and whoever is able to solve this receives my eternal gratitude. progress = QProgressDialog(
"Wait...", "Cancel", 0, 0, self
)
flags = progress.windowFlags()
progress.setWindowFlags(
flags
& ~Qt.WindowCloseButtonHint
& ~Qt.WindowContextHelpButtonHint
| Qt.MSWindowsFixedSizeDialogHint
) Mypy output:
Current possible solution: cast |
I am working on a solution for all QFlags based classes |
The stubs for QMessageBox.critical(), .information(), etc. show the buttons parameter as non-optional. That causes PyCharm to generate a warning. |
You are right. I'll work on a simple fix. |
I just checked, pyqt-stubs describes a default valuefor the buttons parameter, making them effectively optional when calling critical() . I checked with PyCharm, it correctly handles this. I tested with the git version of pyqt5-stubs. Which version did you use on your side ? |
StandardButtons constructor accepting int has been added as part of #153 |
Redundant constructor removed as part of #186 All remarks have been implemented. |
https://github.com/stlehmann/PyQt5-stubs/blob/a3b2eeba10cbd9db4a2840a3b2a53c15d31039c2/PyQt5-stubs/QtWidgets.pyi#L6575-L6580
There are a couple issues with the
QMessageBox.StandardButtons
constructor annotations.Firstly, the second and third annotations are redundant; other than the args names, which I presume are both auto-generated and inaccurate. Neither are valid kwargs.
Secondly, it can also be constructed using
int
objects. AsQMessageBox.StandardButton
extendsint
, this annotation should just be replaced with usingint
objects.>>> QtWidgets.QMessageBox.StandardButtons(0) <PyQt5.QtWidgets.QMessageBox.StandardButtons object at 0x7f56c949dd60>
The text was updated successfully, but these errors were encountered: