Skip to content
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

PR: Add QtCore.Qt.MouseButton.MidButton alias for Qt6 #475

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions qtpy/QtCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@

# Alias for MiddleButton removed in PyQt6 but available in PyQt5, PySide2 and PySide6
Qt.MidButton = Qt.MiddleButton
Qt.MouseButton.MidButton = Qt.MiddleButton

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

# Map DeprecationWarning methods
QCoreApplication.exec_ = lambda *args, **kwargs: possibly_static_exec(
Expand Down
3 changes: 3 additions & 0 deletions qtpy/tests/test_qtcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ def test_enum_access():
)
assert QtCore.Qt.TextColorRole == QtCore.Qt.ItemDataRole.TextColorRole
assert QtCore.Qt.MidButton == QtCore.Qt.MouseButton.MiddleButton
assert (
QtCore.Qt.MouseButton.MidButton == QtCore.Qt.MouseButton.MiddleButton
)


@pytest.mark.skipif(
Expand Down
Loading