larray-project / larray-editor

Graphical User Interface for LArray
GNU General Public License v3.0
2 stars 2 forks source link

add support for Qt6 and remove support for Qt4 #212

Closed alixdamman closed 2 years ago

gdementen commented 3 years ago

moved from larray-project/larray#912

gdementen commented 3 years ago

next time please use the transfer issue feature of github (on bottom of the right column)

alixdamman commented 3 years ago

OK. My bad.

alixdamman commented 3 years ago

Sounds like PyQt doesn't support Qt6 yet by the way. Or I missed something.

gdementen commented 3 years ago

It does, AFAICT: https://pypi.org/project/PyQt6/ Maybe there is no conda packages for that yet though.

gdementen commented 2 years ago

AFAICT, there are still no conda packages for either PyQt6 nor PySide6, so I used:

pip install PyQt6 and pip install PySide6

Note that you can have all 3 (pyqt5, pyqt6, pyside6) installed at the same time and force one of the installed apis by setting the QT_API environment variable to:

For PySide6, I had also to do: set QT_QPA_PLATFORM_PLUGIN_PATH=<myenv>\Lib\site-packages\PySide6\plugins\platforms to make it run. And in any case, with PySide6, the styling was missing (looked a bit like Windows 95 app). It is probably using the "windows" style instead of the "windowsvista" style (see https://doc.qt.io/qt-6/qapplication.html#setStyle-1) and that might be related to the corresponding dll somehow not found by PySide (see https://forum.qt.io/topic/108803/vista-style-is-not-loaded).

The experience with pyqt6 is overall much better than before but still not 100% usable. The latest bug I found is that keyboard navigation in tables is broken (the line keyseq = QKeySequence(event.modifiers() | event.key()) in DataView.keyPressEvent raises a TypeError: unsupported operand type(s) for |: 'KeyboardModifier' and 'int' exception.

My conclusion after passing a few hours on trying to support qt6 is that it is (still!) too early to add 100% support for qt6 because there are still quite a few migration issues and it's a very painful process to find how to solve each of them. QtPy officially supports both APIs but a good chunk of those issues are solvable by qtpy and are not at the moment, so I guess this will get better later. I will try again in a few months.

I will still commit what I have so far because dropping Qt4 is probably a good idea anyway (it lets us clean up our code in a few places), qtpy did the switch from qt4 to 6 and partial support for qt6 is better than no support at all.