-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Fixups with Qt6 enums #13611
Fixups with Qt6 enums #13611
Conversation
can we avoid this? because this sounds like any addon using this will have to be updated to work which is not good |
We can't due to both |
alternative solution was proposed in a different PR: #13337 (comment) try:
# pyside2
return int(QtWidgets.QDialogButtonBox.Close)
except TypeError:
# pyside6
return QtWidgets.QDialogButtonBox.Close.value while this still means that addons will need to update for qt6 compatibility I think it might be better as they will have more time for migration as they'll retain compatibility with the qt5 releases of FreeCAD |
9a941fb
to
43b7504
Compare
Let me explain for a bit. Those
Before my PR, the return value of FreeCAD/src/Gui/TaskView/TaskDialogPython.cpp Lines 730 to 748 in c016f1c
Therefore the following works too.
As you can see |
my question is rather if old workbenches will remain compatible with freecad after this change |
Ahh, gotcha. In that case this change retains compatibility between old workbenches and FreeCAD using PySide2, but it won't be the case if PySide6 is used as those may also have other incompatibilities too (like Maker Workbench for example). Though, getting rid of |
you mean they'll still work after this PR or with the proposal I posted above? PySide6 incompatibility for addons is ok and expected, nothing we can do there they'll have to port. |
They'll work with both my PR and the proposal. In case a regression happens I'll take responsability on it. |
Just noting that we provide a basic compatibility layer between PySide2 and PySide6 so that some addons do not have to change anything. It may be worth investigating if this can be expanded. See the code generation here:
|
I've already sent PRs to three workbenches which had been merged (Zolko-123/FreeCAD_Assembly4#489, shaise/FreeCAD_SheetMetal#333, shaise/FreeCAD_FastenersWB#366), so far I haven't seen any regressions provoked by them. Those were very simple changes so adding them to your workbench isn't that hard and remains compatible with PySide2. |
argggh I had tested this on an addon that had already been ported. I tested now on cfdOF and the task dialog was missing the close button. I made a PR that fixes this but not all addons will get these updates in a timely manner |
since the python changes seem to be compatible with both qt5 and qt6 without any more effort, what's the point of the c++ changes here? |
We can't cast enums to |
Could we make these changes only apply when compiling with pyside6? |
@YakoYakoYokuYoku, damage follows in #13851 |
This fixes the problem: #13902 |
Because PySide6 treats
enum
s andQFlags
asIntEnum
s andIntFlag
s respectively I've added converters for Python PySide enums to C++, and due to this I've modified the requirements of task panel'sgetStandardButtons
to return standard buttons without casting them toint
. Fixes #13605 and part of #13303. Related to #6992.