Bug 127687 - Libreoffice Qt5 VCL plugin not scaling the UI for HiDPI
Summary: Libreoffice Qt5 VCL plugin not scaling the UI for HiDPI
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
(earliest affected) rc
Hardware: All All
: medium normal
Assignee: Luca Carlon
Whiteboard: target:7.0.0
Depends on:
Blocks: HiDPI KDE, KF5 130701
  Show dependency treegraph
Reported: 2019-09-21 18:30 UTC by Doug B
Modified: 2020-06-24 05:10 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:

Screenshot of Libreoffice not scaled correctly using libreoffice-qt5 (118.69 KB, image/png)
2019-09-21 18:31 UTC, Doug B
QT_SCALE_FACTOR=2 fixes the UI scaling, but the text disapears (93.17 KB, image/png)
2019-09-28 18:41 UTC, Doug B
Screenshot with 3840x2160 display (90.58 KB, image/png)
2019-11-20 07:58 UTC, Michael Weghorn
buttons not scaled (32.61 KB, image/png)
2019-11-20 16:35 UTC, Doug B
Comparison of scaling between KDE applications and LO. (662.78 KB, image/jpeg)
2019-12-01 01:28 UTC, Luca Carlon
Icon in menu of standard Qt application. (14.88 KB, image/png)
2019-12-01 13:56 UTC, Luca Carlon

Note You need to log in before you can comment on or make changes to this bug.
Description Doug B 2019-09-21 18:30:19 UTC
I'm on Libreoffice and am using OpenSUSE Tumbleweed. My desktop environment is KDE Plasma. Worth noting that I have seen this error on other Linux distros, but this is the first time I'm officially reporting this bug.

The OpenSUSE package, libreoffice-gtk3, looks perfect on HiDPI. No complaints there.

However, libreoffice-qt5 is not scaled properly. Take a look at the screenshot I have attached. The fonts are scaled fine, but the UI is not. For instance, look at the hamburger menu in the top-right.

Steps to Reproduce:
1. Use HiDPI display 
2. Install Libreoffice, use KDE, and unsure you're using the libreoffice-qt5 VCL plugin. (libreoffice-qt5 package on OpenSUSE)
3. Open Libreoffice

Actual Results:
UI elements are not properly scaled.

Expected Results:
UI elements to be scaled properly.

Reproducible: Always

User Profile Reset: Yes

Additional Info:
Build ID: 30(Build:1)
CPU threads: 8; OS: Linux 5.2; UI render: default; VCL: kde5; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded

I've tried both with and without OpenGL
Comment 1 Doug B 2019-09-21 18:31:33 UTC
Created attachment 154347 [details]
Screenshot of Libreoffice not scaled correctly using libreoffice-qt5
Comment 2 Doug B 2019-09-28 18:41:31 UTC
Created attachment 154626 [details]
QT_SCALE_FACTOR=2 fixes the UI scaling, but the text disapears
Comment 3 Doug B 2019-11-14 20:57:28 UTC
Confirmed on multiple devices of mine. Arch Linux and OpenSUSE.
Comment 4 Xisco Faulí 2019-11-19 11:20:59 UTC
You can't confirm your own bugs. Moving it back to UNCONFIRMED until someone
else confirms it.
Comment 5 Michael Weghorn 2019-11-20 07:58:43 UTC
Created attachment 155966 [details]
Screenshot with 3840x2160 display

I just tested current LibreOffice master on an AOC U3277PWQU screen, resolution is 3840x2160.

The screenshot shows how it looks for me. Everything is pretty tiny due to the high resolution, but I guess that is expected and to me, everything looks correct at a quick glance.

A few questions:

1) What is your screen resolution?
2) Do you have any additional display settings, like scaling,... applied in Plasma's display settings? Font settings etc. could also play a role. Can you possibly try whether using default/different settings makes any difference?
3) As far as I can see from the screenshot, you're using the "Tabbed" user interface (which can be selected in the menu via "View" -> "User Interface" -> "Tabbed"). Does it work correctly when using the "Standard Toolbar" instead, for example?
4) Can you retest whether it works OK for you with a current daily build of LibreOffice master as available at [1]? You can install that one in parallel as described at [2].

I noticed that the icons also look somewhat blurry in your first screenshot. This might be the issue described in bug 122263.

My Version:
Build ID: bc9b046fbd1d68016ae6c53c990fce97b57eb663
CPU threads: 4; OS: Linux 5.2; UI render: default; VCL: kf5; 
Locale: en-GB (en_GB.UTF-8); UI-Language: en-US
Calc: threaded

[1] https://dev-builds.libreoffice.org/daily/master/
[2]  https://wiki.documentfoundation.org/Installing_in_parallel/Linux#Step_2:_Downloading_and_Unpacking_the_Installation_Files
Comment 6 Doug B 2019-11-20 16:34:54 UTC
I'm thinking that this bug may be somewhat related to these two things.
- https://www.reddit.com/r/kde/comments/cnb6sg/hidpi_scaling_on_the_desktop_itself/
- https://bugs.kde.org/show_bug.cgi?id=356446

1.) 2880x1800 - Mid-2015 Macbook Pro
2.) Yes, the Global Scale in Plasma's display configuration is set to 2. Doesn't seem to make a difference to tweak around. 

Please refer to my screenshot where I altered the env variable QT_SCALE_FACTOR. That fixed the UI sizing but made the text disappear. 

3.) The toolbar icon sizes are fine, but the UI elements still don't look right. Plus if you go into Tools>>Options, the buttons aren't properly scaled. Check out my new attachment "buttons not scaled.png"

4.) I'll try the daily build and get back to you.
Comment 7 Doug B 2019-11-20 16:35:45 UTC
Created attachment 155981 [details]
buttons not scaled
Comment 8 Doug B 2019-11-20 16:37:11 UTC
Comment on attachment 155981 [details]
buttons not scaled

On the left is the Libreoffice Options window. On the right is a KDE application where the buttons are scaled correctly.
Comment 9 QA Administrators 2019-11-21 03:33:47 UTC Comment hidden (obsolete)
Comment 10 Doug B 2019-11-26 01:42:14 UTC
Just tried things out with a daily build. Same issue, no difference.

The particular build I tried was "master~2019-11-25_14.20.57_LibreOfficeDev_6.5.0.0.alpha0_Linux_x86-64_rpm"
Comment 11 Luca Carlon 2019-12-01 01:28:12 UTC
Created attachment 156209 [details]
Comparison of scaling between KDE applications and LO.

I have the same issue. Scaling does not seem to be consistent with the rest of the environment. Icons and other views do not seem to respect the scaling applied to KDE. Fonts instead seems to be properly scaled.
I attached an image showing how menu icons are different and how other widgets differ. On the top left, there is a LO menu, while on the top right there is Konsole menu. In this case checkboxes and icons are way too small.
At the bottom, there is a similar comparison of widgets.
Comment 12 Luca Carlon 2019-12-01 13:56:20 UTC
Created attachment 156221 [details]
Icon in menu of standard Qt application.

Don't know if this can be of any help, but I attached a shot of the menu of a minimal Qt application. The height of the icons is identical to the height of icons in "native" KDE applications. The icon of LO menus seems much smaller.
Comment 13 Luca Carlon 2019-12-22 18:15:28 UTC
If no one is against it, I can try to have a look at this.
Comment 14 Michael Weghorn 2019-12-22 23:04:39 UTC
(In reply to Luca Carlon from comment #13)
> If no one is against it, I can try to have a look at this.

Please go ahead, and feel free to self-assign this bug then. :-)
Comment 15 Michael Weghorn 2019-12-23 19:04:40 UTC
The code specific to the qt5 VCL plugin and the kf5 one that depends on the qt5 one is in in 'vcl/qt5' and 'vcl/unx/kf5'.
Comment 16 Luca Carlon 2020-01-05 14:18:14 UTC
Hello, anyone interested in reviewing and testing my patch? https://gerrit.libreoffice.org/c/core/+/86239
Comment 17 Commit Notification 2020-03-09 13:20:35 UTC
Luca Carlon committed a patch related to this issue.
It has been pushed to "master":


tdf#127687 Qt5 introduce basic HiDPI scaling

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:

Affected users are encouraged to test the fix and report feedback.
Comment 18 Jan-Marek Glogowski 2020-03-09 13:22:53 UTC
This is a rather large patch. Now lets wait for the bugs this introduces...
Comment 19 Nate Graham 2020-06-24 05:10:51 UTC
JFYI I'm using the 7.0 beta version with the KDE5 VCL and I can report that it's almost perfect.

The only remaining bug I've found is Bug 134054.

There's also an improvement possible with Bug 115439.