Stellarium / stellarium

Stellarium is a free GPL software which renders realistic skies in real time with OpenGL. It is available for Linux/Unix, Windows and macOS. With Stellarium, you really see what you can see with your eyes, binoculars or a small telescope.
https://stellarium.org
GNU General Public License v2.0
7.54k stars 813 forks source link

Qt5 QML #3473

Open DarthGandalf opened 10 months ago

DarthGandalf commented 10 months ago

According to https://github.com/Stellarium/stellarium/issues/2739#issuecomment-1272601781 QML is only supported with Qt6. What specifically stops using QML with Qt5 instead of QtScript?

According to https://github.com/Stellarium/stellarium/blob/2533f48decea2543e2a8a4c8e157f3fc6094acdc/CMakeLists.txt#L480-L482 it should work

Ref https://bugs.gentoo.org/916113 - QtScript is going to be removed from Gentoo

10110111 commented 10 months ago

While I don't have the answer to your question, I wonder why Gentoo bothers to change configuration of a legacy Qt version. Shouldn't all the effort go to the current one, and the legacy version be frozen in maintenance mode?

gzotti commented 10 months ago

QtScript is part of Qt5.15 (LTS), and other software based on Qt5 may use it, so why is it removed? If you entirely remove Qt5 from Gentoo, just switch to Qt6. We have not tested QML with Qt5 recently and do not recommend it in an "official" distribution, given less functionality. It would just confuse users.

a17r commented 10 months ago

1) There is no such thing as maintenance mode in a source-based distribution. Every package we provide must be able to build with an up to date toolchain, newer versions of dependencies that may not be able to sit side-by-side on a system without downstream modifications. We can not just let old packages sit there like in a binary distro. 2) There is no such thing as a clean sweep switch from Qt5 to Qt6 for distributions, it is a drawn-out process. Sometimes upstreams even need to be made aware of the need for porting in the first place, sometimes no one answers anymore, that's when you flag stuff for removal downstream. 3) QtScript is "part of" 5.15 LTS, but it has not received any fixes in years - it is deprecated since 5.5 already, but even then had only been provided for compatibility to Qt 4 in the fist place. It is a dead end with many known issues and that makes it a prime target to identify troubled reverse dependencies early, and get downstream maintainers to communicate with upstreams. Stellarium, therefore, showed up in that list.

The good news is that you've already ported to Qt6, and Gentoo's downstream maintainer for Stellarium provides that option. Unfortunately, Qt6 applications will look bad in Qt5-based DEs for some time to come, which means Qt6 build option would be a bad default until well into 2024.

So, the worst thing that would happen to Stellarium is to look slightly out of place. It is, however, the only piece of software I've seen to choose to keep a QtScript codebase in the process of porting to Qt6, that makes it the odd one out.

DarthGandalf commented 10 months ago

Unfortunately, Qt6 applications will look bad in Qt5-based DEs for some time to come, which means Qt6 build option would be a bad default until well into 2024.

Stellarium does its own UI, independent from the Qt widgets theme, so this is not actually a concern here. So I guess I should just disable the Qt5 option for the Stellarium Gentoo package

gzotti commented 10 months ago

I have zero time this week for fixes. What kinds of error appear when you build with Qt5 and QML script? This is just the option nobody wants, given the demise of pauseScript() in QML.

a17r commented 10 months ago

That seems to imply Stellarium with Qt6 QML does not have the same limitations/less functionality as a theoretical Qt5 QML version?

@DarthGandalf: Possible, the only downside is potentially pulling in both qtwebengine slots for some users - but they can disable it, and QtWebEngine5 will only be the next tracker to identify porting stragglers.

Please note there is no hurry here. The qtscript-removal tracker is a mid-longterm process.

gzotti commented 10 months ago

QML-based scripting has lost the ability to pause/resume script execution. Until a JS genius fixes that for us, we recommend "staying at Qt5" (implying "using QtScript", although QML should technically work with Qt5.15) when this is essential for some users. Else, some syntactic changes (3D vectors, colors) can be overcome by applying common new syntax in both versions.

DarthGandalf commented 10 months ago

@gzotti who is supposed to call resumeScript()? I see the function defined, but noone seems to call it, so after a script called pauseScript() there's no way for it to resume?

10110111 commented 10 months ago

@DarthGandalf see this line:

actionsMgr->addAction("actionResume_Script", datetimeGroup, N_("Resume script execution"), this, "resumeScript()", "Ctrl+D, R");
DarthGandalf commented 10 months ago

ok, I see the problem.

If the script itself called core.pauseScript(), stellarium could do the same explicit event processing like it does now using QScriptEngineAgent, and similar to what it does in core.wait(), even in Qt6, until user resumes it via GUI.

However, there's no good way to pause the script via GUI, when the script didn't expect that itself. The best option I see is to check isPaused in every JS-callable function of StelMainScriptAPI... and all other functions callable from JS. That does somewhat decrease the frequency when exactly the script would be paused