spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.34k stars 3.06k forks source link

Qt desktop GUI: upgrade to Qt6 (`gui/qt/`, QtWidgets) #8007

Open SomberNight opened 1 year ago

SomberNight commented 1 year ago

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:

SomberNight commented 1 year ago

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?)

accumulator commented 1 year ago

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

SomberNight commented 1 year ago

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.

SomberNight commented 1 year ago

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.

accumulator commented 1 year ago

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).

SomberNight commented 1 year ago

Yes, I agree. Looks like it's better to wait for now.

SomberNight commented 11 months ago

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.

accumulator commented 11 months ago

we might simply try-except import 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.