Qt desktop GUI: upgrade to Qt6 (`gui/qt/`, QtWidgets)
Opening this issue to discuss if it is time to upgrade to Qt6, for the desktop Qt GUI.
Qt5 is not getting any more updates. The latest Qt version atm is 6.4. Qt6.2 was an LTS version, so I expect Qt6 is mature now.
Just like pyqt5, pyqt6 is also available on PyPI, from the same maintainer.
There is the question of compatibility with OSes:
- Windows
- Qt6 dropped support of win7 and 8.1 (see https://doc.qt.io/qt-6.2/supported-platforms.html#windows)
- we already don't support win7 (see https://github.com/spesmilo/electrum/issues/7728)
- would have to drop support of win8.1
- Qt6 dropped support of win32 (x86, 32-bit), it requires amd64
- see https://github.com/spesmilo/electrum/issues/6598
- Qt6 dropped support of win7 and 8.1 (see https://doc.qt.io/qt-6.2/supported-platforms.html#windows)
- macOS
- we currently build on macOS 10.14, and support >=10.13 as targets
- this would bump the min supported version to 10.14
- see https://github.com/spesmilo/electrum/issues/3685#issuecomment-508556343
- unlike pyqt5, pyqt6 has native binaries for (apple-flavoured-)arm64
- Linux
- Debian
- debian 11 does not have
python3-pyqt6 - debian 12 (stable, released 2023-06) has
python3-pyqt6- https://packages.debian.org/bookworm/python3-pyqt6
- debian 11 does not have
- Ubuntu
- ubuntu 22.04 LTS does not have
python3-pyqt6 - ubuntu 22.10 (unreleased) has
python3-pyqt6- https://packages.ubuntu.com/kinetic/python3-pyqt6
- ubuntu 22.04 LTS does not have
- Arch Linux
- has
python-pyqt6- https://archlinux.org/packages/extra/x86_64/python-pyqt6/
- has
- Manjaro
- has
python-pyqt6- https://software.manjaro.org/package/python-pyqt6
- has
- Debian
As long as debian stable, and the latest ubuntu LTS do not have packages, I think it is too early to upgrade to Qt6.
(which I guess means we will wait until ubuntu 24.04?)
As Electrum-QML is only targeting android, not having PyQt6 available in the distro is only an issue for developers. The android build container builds PyQt itself.
Edit: ah yes, I didn't see you are specifically talking about the desktop UI
Right, but I think we can upgrade the desktop Qt GUI and the android qml GUI independently. I am specifically looking at considerations for the desktop Qt GUI here. I'll change the title to clarify.
Re android qml, we are building most components ourselves, so these considerations do not apply.
To be even more clear, I mean this issue is about electrum/gui/qt, the QtWidgets GUI. So I do not mean running the electrum/gui/qml GUI on desktop as part of development.
For linux distro users to be able to run electrum, it matters whether the dependencies are packaged. Also, if we want electrum itself to be packaged by distros, which I guess is not a priority, but e.g. Tails packages electrum, then again it matters if the deps are available.
I don't think we currently gain anything by upgrading to Qt6. Unless there are features in Qt6 that we absolutely need, it's probably better to be 'most compatible' with all the LTS distro's out there. Qt6 is only just hitting the latest distribution releases, so it'll be a while still until Qt6 is widely available. In the mean time, most distro's that do ship Qt6 will also have Qt5 co-installable (AFAIK).
Yes, I agree. Looks like it's better to wait for now.
Note: https://github.com/spesmilo/electrum/pull/8560 is introducing gui/common_qt/, which is used by both gui/qt/ and gui/qml/. common_qt makes it difficult to use different Qt versions in the qml and qt guis.
Note: the qtpy 3rd-party library provides APIs to abstract away Qt5/Qt6. We happen to already depend on qtpy indirectly through qdarkstyle.
Though as long as there is not a lot of code in common_qt, we might simply try-except import from both pyqt5 and pyqt6 at the top of the file.
we might simply
try-exceptimport from both pyqt5 and pyqt6 at the top of the file.
This should be sufficient. There's not much common code yet, and what is there is fairly trivial, and shouldn't need version specifics.