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

ENH: Add Pyside6 compatible UI file compilation #1163

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

nstelter-slac
Copy link
Collaborator

@nstelter-slac nstelter-slac commented Jan 24, 2025

this should be reviewed later, since the diff should be clear when my previous patches merge in

nstelter-slac and others added 6 commits January 10, 2025 18:17
…t6 enum support

The need for inheritance was b/c  when an enum gets written to a ui file by
designer, its in the form of <widget class name>::<enum value> (ex='PyDMLabel::STRING').

On loading the ui file, unless the widget class had subclassed the enum class it
would not be able to find the definition of the enum.

The issue with subclassing the enum is:  in qt6 enums must inherit
from python Enum (ex = class MyNewEnum(Enum)), and these classes can not be
inherited from.

So instead of inheriting the enum we can just re-declare the values of the enum
in the class itself.
To support enums as part of widget-classes in pyside6, and to have them work in
designer, requires a bit different implementation than in pyqt5:
https://doc.qt.io/qtforpython-6/PySide6/QtCore/QEnum.html

Also switch from 'Q_ENUMS' -> 'Q_ENUM', since its a newer verison of enum macro for pyqt5.
and fix few small typos in comments
@nstelter-slac nstelter-slac marked this pull request as draft January 24, 2025 04:41
@nstelter-slac nstelter-slac force-pushed the pyside6_ui_compilation branch from 724093c to 7269b62 Compare January 24, 2025 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant