Bug 145734 (Qt6) - [META] Qt6 VCL plugin bugs and enhancements
Summary: [META] Qt6 VCL plugin bugs and enhancements
Status: NEW
Alias: Qt6
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.3.0.0 alpha0+
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on: 135386 145735
Blocks: Desktop-Environment
  Show dependency treegraph
 
Reported: 2021-11-17 13:19 UTC by Michael Weghorn
Modified: 2022-09-20 06:36 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Weghorn 2021-11-17 13:19:46 UTC
This meta bug is used to track aspects specific to the qt6 VCL plugin.

See also meta bugs for qt5 (tdf#125943) and KDE/kf5 (tdf#102495).
Comment 1 Roman Kuznetsov 2021-11-18 19:36:42 UTC
Set to NEW
Comment 2 Timur 2022-09-14 11:41:42 UTC
Hi Michael, I have some questions that I put here, may be useful also to others.

1. I understand you are the author of libreoffice-qt6, I found rpm version on the web, but it's not in Ubuntu 22.04 repos, do you know why? 
Does that prevent successful running of "SAL_USE_VCLPLUGIN=qt6 soffice", where I see gtk3 in Help-About? 

2. In my Mint 19.3 (based on Ubuntu 18.04) different VCL are working, including with OS dark mode. 
In Ubuntu 22.04 with OS dark mode, only LO gtk3 works with dark mode, kf5 and qt5 not (libreoffice-qt5 and libreoffice-kf5 installed, not full KDE or plasma-desktop). Seems the same for Wayland and X11. 
Any idea how I can make them work?
Comment 3 Michael Weghorn 2022-09-14 14:12:11 UTC
(In reply to Timur from comment #2)
> 1. I understand you are the author of libreoffice-qt6, I found rpm version
> on the web, but it's not in Ubuntu 22.04 repos, do you know why? 
> Does that prevent successful running of "SAL_USE_VCLPLUGIN=qt6 soffice",
> where I see gtk3 in Help-About? 

The qt6 VCL plugin is essentially the qt5 VCL plugin built against Qt 6 (plus some changes needed for Qt 6), commit adding it:
https://git.libreoffice.org/core/commit/88d57cf241209ffec9eaed3e523942ab51af6db6

For it to be available in Ubuntu, it would have to be packaged, which apparently hasn't happened so far. One reason for this might be that the qt6 VCL plugin was never mentioned in the LO release notes - mainly because it was initially mostly meant to be used for own experimenting before making it "official".
But at least from my (developer's) experience, I haven't run into any
issues that are specific to the qt6 VCL plugin (as compared to the qt5/kf5 one)
for a while when used together with recent versions of Qt 6.
(Well OK, looking at this meta bug again, there is the issue with video playback on Wayland, tdf#145735.... tdf#135386 was just moved here because making a11y work requires changes to the Qt library in addition, which aren't going to happen for Qt 5.)

Triggered by your question, I have now submitted a packaging request to the Debian bug tracker:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019740

(I think Ubuntu takes over LO packaging from Debian, so having it packaged in Debian would then also make it available in future Ubuntu releases.)


> 2. In my Mint 19.3 (based on Ubuntu 18.04) different VCL are working,
> including with OS dark mode. 
> In Ubuntu 22.04 with OS dark mode, only LO gtk3 works with dark mode, kf5
> and qt5 not (libreoffice-qt5 and libreoffice-kf5 installed, not full KDE or
> plasma-desktop). Seems the same for Wayland and X11. 
> Any idea how I can make them work?

What desktop environment do you use and how are you enabling OS dark mode? Desktop environment based on Gtk might possibly not change the style for Qt-based applications when switching to dark mode in the OS settings (but I don't know exactly).

What should still work is to set the QT_STYLE_OVERRIDE environment variable (and make sure the corresponding Qt style packages are installed), e.g. I get kf5 with a dark theme when I start LO with

    QT_STYLE_OVERRIDE="Adwaita-Dark" ./instdir/program/soffice.bin --writer

even if the system theme/style is not set to dark mode.
Comment 4 Timur 2022-09-15 11:41:39 UTC
(In reply to Michael Weghorn from comment #3)
> What desktop environment do you use and how are you enabling OS dark mode?

Default Ubuntu 22.04 is Gnome. Dark mode via in-build Appearance: Dark theme in Ubuntu. It's Yaru theme. Adwaita is also available, can be set with gnome-tweaks.

>     QT_STYLE_OVERRIDE="Adwaita-Dark" ./instdir/program/soffice.bin --writer
> even if the system theme/style is not set to dark mode.

This doesn't work in my Mint 19, where I see theme names. Themes are set separately for Window borders, Icons, Controls, Mouse Pointer, Desktop (it's Controls that's relevant). Never mind, as dark works in Gtk3 and all other VCL via SAL_USE_VCLPLUGIN. 

Also couldn't get QT_STYLE_OVERRIDE to work in Ubuntu 22.04.
I only could get gtk3 app to be dark in light mode with:
GTK_THEME=Adwaita-dark  soffice
But combination with SAL_USE_VCLPLUGIN for kf5, qt5 didn't work.
Comment 5 Michael Weghorn 2022-09-15 15:18:09 UTC Comment hidden (obsolete)
Comment 6 Timur 2022-09-16 14:43:09 UTC
(In reply to Michael Weghorn from comment #5)
> Do you have package adwaita-qt installed (i.e. the Qt 5 port of Adwaita)? 
Yes. But I added it myself, I think it should install as a dependancy of libreoffice-qt5.

> Is there any related error/warning on stderr when you run that in a terminal?
Not when only QT_STYLE_OVERRIDE is run. I'm not using debug version. 
 
> maybe this might be of help (but I don't have any deeper insights myself):
> https://wiki.archlinux.org/title/
> qt#Configuration_of_Qt_5_applications_under_environments_other_than_KDE_Plasm
> a

Yes, setting qt5ct gives dark mode in light OS with "SAL_USE_VCLPLUGIN=qt5 soffice", same with kf5. Even without setting env. variable QT_QPA_PLATFORMTHEME=qt5ct. That's for Ubuntu 22.04 with Gnome. 

Wayland (default in Ubuntu 22.04) has error messages. Just running VCL doesn't work, and it says: "Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway."
But Wayland also works with "QT_QPA_PLATFORMTHEME=qt5ct SAL_USE_VCLPLUGIN=qt5 soffice", except it still gives the same error message.

Runnnig "QT_QPA_PLATFORM=wayland SAL_USE_VCLPLUGIN=qt5 soffice" gives error: "Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
QSocketNotifier: Can only be used with threads started with QThread
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()"
Comment 7 Michael Weghorn 2022-09-16 16:07:31 UTC
(In reply to Timur from comment #6)
> (In reply to Michael Weghorn from comment #5)
> > Do you have package adwaita-qt installed (i.e. the Qt 5 port of Adwaita)? 
> Yes. But I added it myself, I think it should install as a dependancy of
> libreoffice-qt5.

That's up to distro packagers to decide, but I personally don't think it should be a dependency. LO can run just fine with any Qt style, and the Qt packages that libreoffice-qt5 depends on bring some styles with them. So only people who actually want to use the Adwaita theme need the package.


> Yes, setting qt5ct gives dark mode in light OS with "SAL_USE_VCLPLUGIN=qt5
> soffice", same with kf5. Even without setting env. variable
> QT_QPA_PLATFORMTHEME=qt5ct. That's for Ubuntu 22.04 with Gnome.

Great :)

> Wayland (default in Ubuntu 22.04) has error messages. Just running VCL
> doesn't work, and it says: "Warning: Ignoring XDG_SESSION_TYPE=wayland on
> Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway."
> But Wayland also works with "QT_QPA_PLATFORMTHEME=qt5ct
> SAL_USE_VCLPLUGIN=qt5 soffice", except it still gives the same error message.

IIUC, that's a warning, not an error message, and it's not LibreOffice-specific, but I'd expect you'd see the same warning when running any Qt/KDE application (e.g. kate) in a GNOME Wayland session.
For some reason (probably problems...), the "xcb" (i.e. X11) backend is used for Qt applications by default, even when run in a Wayland session, i.e. the application is using the X11 Qt platform plugin and running under XWayland, rather than as a native Wayland application.
As you noticed, you can force the use of the wayland backend using QT_QPA_PLATFORM=wayland.

You can even verify what QPA is being used in "Help" -> "About LibreOffice", too.)


> Runnnig "QT_QPA_PLATFORM=wayland SAL_USE_VCLPLUGIN=qt5 soffice" gives error:
> "Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use
> QT_QPA_PLATFORM=wayland to run on Wayland anyway.
> QSocketNotifier: Can only be used with threads started with QThread
> qt.qpa.wayland: Wayland does not support QWindow::requestActivate()"

Is that actually an error and the application crashes or doesn't start or is it just a warning and the application runs fine otherwise. (I think I've seen that, too, but everything worked fine for me.)
Comment 8 Timur 2022-09-16 20:06:58 UTC Comment hidden (obsolete)
Comment 9 Michael Weghorn 2022-09-17 08:00:42 UTC
(In reply to Timur from comment #8)
> In the last case (if I remember well)  soffice starts but with light gtk3
> and not dark qt5. So I didn't figure out how to use QT_QPA_PLATFORM.

That sounds very odd. Looking at the above output again:

> Runnnig "QT_QPA_PLATFORM=wayland SAL_USE_VCLPLUGIN=qt5 soffice" gives error:
> "Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use
> QT_QPA_PLATFORM=wayland to run on Wayland anyway.
> QSocketNotifier: Can only be used with threads started with QThread
> qt.qpa.wayland: Wayland does not support QWindow::requestActivate()"

You are actually already setting QT_QPA_PLATFORM=wayland, so the message is weird. And then, the 'QSocketNotifier' message shows that this is actually using Qt, but you mention it starts with gtk3. Can you possibly try that once again to double-check?
Comment 10 Timur 2022-09-19 10:42:01 UTC
I remembered wrong, it is wayland, but doesn't inherit dark mode. 
Runnnig "QT_QPA_PLATFORM=wayland SAL_USE_VCLPLUGIN=qt5 soffice" in Ubuntu 22.04 Wayland with dark theme gives error as written (Warning part seems redundant) but it starts LO with light qt5 (qfont+wayland in About) or kf5 (cairo+wayland in About).

Runnnig "QT_QPA_PLATFORMTHEME=qt5ct SAL_USE_VCLPLUGIN=qt5 soffice" in Ubuntu 22.04 Wayland with dark theme gives same Warning which makes sense here. It starts LO with dark qt5 (qfont+xcb in About) or kf5 (cairo+xcb in About).

Runnig "QT_STYLE_OVERRIDE="Adwaita-Dark" SAL_USE_VCLPLUGIN=qt5 soffice" in Wayland light (that is GTK3) starts dark qt5 (xcb in About). So it's OK, I don't know how I tested before. 
To start LO as dark GTK3 in light OS: GTK_THEME=Adwaita-dark soffice.

I also tested with Mint 21 based on Ubuntu 22.04 and in Cinnamon all is working fine, qt5/kf5 can be started, inheriting dark mode. 
In their Ubuntu/Xorg meaning Wayland/Gnome, I couldn't set dark mode with a click, so I didn't test further, but there is qt5cl workaround.


To go back to this issue title, I also don't see libreoffice-qt6 in OpenSuse, please ask to be added.
IIUC, we need that package to be able to test LO with qt6.
Comment 11 Michael Weghorn 2022-09-20 06:36:46 UTC
Thanks for the update, good to hear it's working now.

(In reply to Timur from comment #10)
> To go back to this issue title, I also don't see libreoffice-qt6 in
> OpenSuse, please ask to be added.

I'm not using OpenSUSE myself and don't know about the exact processes there. Please feel free to ask there yourself (and let me know in case any additional input should be needed from my side).

Please also note the discussion in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019740 :
At this point, qt6 isn't used by default in any desktop environment and it probably won't before desktop environments based on Qt 6 (like Plasma 6) are there, so the qt6 VCL plugin is currently mostly for people who deliberately want to use it, which may or may not be a reason for distros to still wait before packaging it. (Just having qt6 installed won't affect users at all unless they explicitly set SAL_USE_VCLPLUGIN=qt6 to choose to use it.)

> IIUC, we need that package to be able to test LO with qt6.

Yes. I think the best way to provide the package depends a bit on the actual use case. Distros will typically only provide the latest released LO version, so in case you want to test daily builds, that would need another approach (like having qt6 in TDF builds, or if it's only a limited amount of users I could also upload a build of mine somewhere every once in a while,...). Would be good to know what the exact needs are there right.
Since the qt6 VCL plugin shares most of the code with qt5, I'd expect that the two will behave the same for most situations as of now, but any testing is appreciated of course. :-)