Skip to content

Commit 2cc5fc4

Browse files
authored
PR: Add QtCore.Qt.MouseButton.MidButton alias for Qt6 (#475)
2 parents cc54a5e + 78d721e commit 2cc5fc4

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

qtpy/QtCore.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787

8888
# Alias for MiddleButton removed in PyQt6 but available in PyQt5, PySide2 and PySide6
8989
Qt.MidButton = Qt.MiddleButton
90+
Qt.MouseButton.MidButton = Qt.MiddleButton
9091

9192
# Add removed definition for `Qt.ItemFlags` as an alias of `Qt.ItemFlag`
9293
# passing as default value 0 in the same way PySide6 6.5+ does.
@@ -142,6 +143,7 @@
142143
) = Qt.BackgroundRole
143144
Qt.TextColorRole = Qt.ItemDataRole.TextColorRole = Qt.ForegroundRole
144145
Qt.MidButton = Qt.MiddleButton
146+
Qt.MouseButton.MidButton = Qt.MiddleButton
145147

146148
# Map DeprecationWarning methods
147149
QCoreApplication.exec_ = lambda *args, **kwargs: possibly_static_exec(

qtpy/tests/test_qtcore.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ def test_enum_access():
188188
)
189189
assert QtCore.Qt.TextColorRole == QtCore.Qt.ItemDataRole.TextColorRole
190190
assert QtCore.Qt.MidButton == QtCore.Qt.MouseButton.MiddleButton
191+
assert (
192+
QtCore.Qt.MouseButton.MidButton == QtCore.Qt.MouseButton.MiddleButton
193+
)
191194

192195

193196
@pytest.mark.skipif(

0 commit comments

Comments
 (0)