Skip to content

Commit 71c8daf

Browse files
committed
Incorrectly implement QMessageBox.StandardButton[s].__or__
1 parent 811462b commit 71c8daf

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

PyQt5-stubs/QtWidgets.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6477,7 +6477,12 @@ class QMenuBar(QWidget):
64776477

64786478
class QMessageBox(QDialog):
64796479

6480-
class StandardButton(int): ...
6480+
class StandardButton(int):
6481+
@typing.overload # type: ignore[override]
6482+
def __or__(self, other: typing.Union['QMessageBox.StandardButton', 'QMessageBox.StandardButtons']) -> 'QMessageBox.StandardButtons': ...
6483+
@typing.overload
6484+
def __or__(self, other: int) -> int: ...
6485+
64816486
NoButton = ... # type: 'QMessageBox.StandardButton'
64826487
Ok = ... # type: 'QMessageBox.StandardButton'
64836488
Save = ... # type: 'QMessageBox.StandardButton'
@@ -6539,6 +6544,7 @@ class QMessageBox(QDialog):
65396544
def __invert__(self) -> 'QMessageBox.StandardButtons': ...
65406545
def __index__(self) -> int: ...
65416546
def __int__(self) -> int: ...
6547+
def __or__(self, other: typing.Union[int, 'QMessageBox.StandardButtons', 'QMessageBox.StandardButton']) -> 'QMessageBox.StandardButtons': ...
65426548

65436549
@typing.overload
65446550
def __init__(self, parent: typing.Optional[QWidget] = ...) -> None: ...

tests/qmessagebox.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from PyQt5 import QtWidgets
2+
3+
QtWidgets.QMessageBox.question(
4+
None,
5+
"Confirm",
6+
"Are you sure?",
7+
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
8+
)

0 commit comments

Comments
 (0)