MNT: remove widget classes inheritance from enum, as preperation for qt6 enum support #1154
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This should fix main issue making it difficult to support both PyQt5 and PySide6 enums at same time!
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 wouldn't 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 we can just re-declare the values of the enum in the class itself, mimicking if the class had inherited from the enum.