Skip to content

Use fully qualified Qt enum names in Python#4512

Open
dj-mcg wants to merge 1 commit intoAutodesk:devfrom
dj-mcg:pr/Update_Qt_Enum_Names
Open

Use fully qualified Qt enum names in Python#4512
dj-mcg wants to merge 1 commit intoAutodesk:devfrom
dj-mcg:pr/Update_Qt_Enum_Names

Conversation

@dj-mcg
Copy link
Collaborator

@dj-mcg dj-mcg commented Mar 4, 2026

PyQt6 and PySide6 expose C++ enums as Python enum.Enums, dropping the shorter path that matches the namespace of the enum in C++. For instance, where QtEvent::Type values are non-scoped enums in C++, e.g. QtEvent::Type { KeyPress } is QtEvent::KeyPress. This was exposed in PyQt5/PySide2 as QtEvent.KeyPress and QtEvent.Type.KeyPress in preparation for a switch to use Python enums. In PyQt6/PySide6 this enum member is only available as QtEvent.Type.KeyPress.

This change updates all Qt enum usage in Python to use the fully-qualified names, which is backwards-compatible with PyQt5/PySide2.

PyQt6 and PySide6 expose C++ enums as Python `enum.Enum`s, dropping the
shorter path that matches the namespace of the enum in C++. For
instance, where `QtEvent::Type` values are non-scoped enums in C++, e.g.
`QtEvent::Type { KeyPress }` is `QtEvent::KeyPress`. This was exposed in
PyQt5/PySide2 as `QtEvent.KeyPress` _and_ `QtEvent.Type.KeyPress` in
preparation for a switch to use Python enums. In PyQt6/PySide6 this enum
member is only available as `QtEvent.Type.KeyPress`.

This change updates all Qt enum usage in Python to use the
fully-qualified names, which is backwards-compatible with PyQt5/PySide2.
@seando-adsk seando-adsk added the build Related to building maya-usd repository label Mar 5, 2026
Copy link
Collaborator

@pierrebai-adsk pierrebai-adsk left a comment

Choose a reason for hiding this comment

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

Good work!

@seando-adsk
Copy link
Collaborator

@dj-mcg Could you add a sentence in the Coding guidelines for Python section of our codingGuidelines.

@seando-adsk seando-adsk added ready-for-merge Development process is finished, PR is ready for merge and removed ready-for-merge Development process is finished, PR is ready for merge labels Mar 6, 2026
@dj-mcg
Copy link
Collaborator Author

dj-mcg commented Mar 13, 2026

@dj-mcg Could you add a sentence in the Coding guidelines for Python section of our codingGuidelines.

Oh sure - will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Related to building maya-usd repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants