Skip to content

PR: Promote enum aliases#319

Merged
dalthviz merged 4 commits intospyder-ide:masterfrom
MatthieuDartiailh:enum-aliases
Jan 28, 2022
Merged

PR: Promote enum aliases#319
dalthviz merged 4 commits intospyder-ide:masterfrom
MatthieuDartiailh:enum-aliases

Conversation

@MatthieuDartiailh
Copy link
Copy Markdown
Contributor

A number of enum values in QT can be accessed through aliases. For example, QSlider.TicksPosition has both TicksAbove and TicksLeft and TicksLeft is an alias of TicksAbove.

Currently, enums are only iterated which yield their variants but miss the existence of aliases. This patch explicitly iterate over the enum members to catch all aliases. Tests are included, both for TicksLeft which is a documented alias (https://doc.qt.io/qt-6/qslider.html#TickPosition-enum) and SC_SliderGroove which happens to have the same value as SC_ScrollBarAddLine and hence appears as an alias.

A number of enum values in Qt are actually aliases and one need to inspect the enum members to find the names under which some values are aliased.
@CAM-Gerlach CAM-Gerlach requested a review from dalthviz January 28, 2022 11:07
@ccordoba12 ccordoba12 changed the title Enum aliases PR: Promote enum aliases Jan 28, 2022
@dalthviz dalthviz added this to the v2.0.1 milestone Jan 28, 2022
Copy link
Copy Markdown
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @MatthieuDartiailh for helping with this!

Could you remove also in this PR the manual aliases done here?:

qtpy/qtpy/QtCore.py

Lines 51 to 53 in 74dd309

# Map missing unscoped access enum values
Qt.BackButton = Qt.XButton1
Qt.ForwardButton = Qt.XButton2

With this change I think those lines are now unnecessary.

Note: Some related issues/PRs: #306 #314

@MatthieuDartiailh
Copy link
Copy Markdown
Contributor Author

Done

Copy link
Copy Markdown
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @MatthieuDartiailh ! 👍

@dalthviz dalthviz linked an issue Jan 28, 2022 that may be closed by this pull request
@dalthviz dalthviz merged commit 2e36012 into spyder-ide:master Jan 28, 2022
@MatthieuDartiailh MatthieuDartiailh deleted the enum-aliases branch January 28, 2022 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Qt6: missing unscoped enum values

2 participants