Bug 1381828

Summary: Broken window scaling for some QT5 applications
Product: [Fedora] Fedora Reporter: Marco Kundt <mrckndt>
Component: qt5-qtbaseAssignee: Rex Dieter <rdieter>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: amlau, ben.r.xiao, dtantsur, fzatlouk, geert.warrink, helio, jan.public, jgrulich, jreznik, k333152, kparal, ksyblast, laurent.rineau__fedora, leigh123linux, mkourim, nixuser, rdieter, than, thomas.pi
Target Milestone: ---Keywords: CommonBugs, Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: https://fedoraproject.org/wiki/Common_F25_bugs#qt5-scaling-too-aggresive
Fixed In Version: qt5-qtbase-5.7.1-13.fc25 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-29 11:46:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Screenshot of broken seafile
none
Calibre on Wayland (Native)
none
Calibre on Wayland (XWayland)
none
Spyder on Wayland (Native)
none
Spyder on Wayland (XWayland)
none
Spyder on Wayland (XWayland)
none
Spyder on X
none
mediawriter laptop vs external screen
none
mediawriter with QT_QPA_PLATFORM=wayland-egl
none
mediawriter on 2 external monitors
none
mediawriter on 2 external monitors when 1 is rotated
none
Seafile-client on Fedora 25 w/ Wayland
none
Fedora25_Gnome_Applications_Scaled_And_Unusable
none
Proposed fix none

Description Marco Kundt 2016-10-05 07:10:48 UTC
Created attachment 1207457 [details]
Screenshot of broken seafile

Description of problem:
Some QT5 programs seems to have problems with the window scaling. I'm using an 1920x1080 display without scaling but for example seafile-client is enormous (which can be seen in the attachment). The same appears to happen to the newly to QT5-ported vlc, so i think it's rather an Qt bug than seafile-client. Strangely i don't having any problems with yubikey-personalisation-gui which also depends on Qt5. 

Version-Release number of selected component (if applicable):
qt5-qtbase: 5.6.1-3
seafile-client: 5.1.1-3
qgnomeplatform: 0.2-9.20160718git

How reproducible:
Install and open seafile-client on 1080p display.

Actual results:
See attachment.

Additional info:
The Fedora 24 install is freshly installed and the computer is an ThinkPad x250 with Intel graphics.

Comment 1 František Zatloukal 2016-10-19 13:58:39 UTC
This affects all of Qt5 apps in my case. It doesn't matter if I use Wayland, XWayland or pure X, scaling is broken everywhere. I can't find any patterns in breakage, it depends on connecting/disconnecting external monitor (both display and monitor are FULL HD).

I've attached screenshots, I hope I didn't do any mistake when naming the files.

Apart from broken scaling, VLC outputs video only to 1/4th of screen.

I am running Fedora 25, so qt5-qtbase-5.7.0-3

Comment 2 František Zatloukal 2016-10-19 14:00:48 UTC
Created attachment 1212158 [details]
Calibre on Wayland (Native)

Comment 3 František Zatloukal 2016-10-19 14:01:24 UTC
Created attachment 1212159 [details]
Calibre on Wayland (XWayland)

Comment 4 František Zatloukal 2016-10-19 14:02:01 UTC
Created attachment 1212160 [details]
Spyder on Wayland (Native)

Comment 5 František Zatloukal 2016-10-19 14:02:32 UTC
Created attachment 1212161 [details]
Spyder on Wayland (XWayland)

Comment 6 František Zatloukal 2016-10-19 14:03:07 UTC
Created attachment 1212162 [details]
Spyder on Wayland (XWayland)

Comment 7 František Zatloukal 2016-10-19 14:03:45 UTC
Created attachment 1212163 [details]
Spyder on X

Comment 8 Jaroslav Reznik 2016-10-20 08:53:06 UTC
Could you try it without qgnomeplatform?

Comment 9 Martin Bříza 2016-10-21 13:20:11 UTC
Marco and Frantisek, can you please post the output of xrandr --list?

Comment 10 František Zatloukal 2016-10-21 13:28:59 UTC
(In reply to Martin Bříza from comment #9)
> Marco and Frantisek, can you please post the output of xrandr --list?

$ xrandr --list
xrandr: unrecognized option '--list'
Try 'xrandr --help' for more information.

$ xrandr 
Screen 0: minimum 320 x 200, current 1920 x 2160, maximum 8192 x 8192
XWAYLAND0 connected 1920x1080+0+1080 310mm x 170mm
   1920x1080     59.96*+
XWAYLAND2 connected 1920x1080+0+0 510mm x 290mm
   1920x1080     59.96*+

Will post result from X session when I have time to logout.

Comment 11 František Zatloukal 2016-10-21 13:32:45 UTC
Btw, I've figured out this behaviour:

Laptop screen = bad scaling
External screen in the office = bad scaling
External screen @home = OK

All of them are 1920 x 1080 (but different physical size). I'll post xrandr output for all of them.

Comment 12 František Zatloukal 2016-10-21 14:35:44 UTC
Ok, my laptop screen:
eDP1 connected 1920x1080+0+1080 (normal left inverted right x axis y axis) 310mm x 170mm
   1920x1080     60.01*+
   1400x1050     59.98  
   1600x900      60.00  
   1280x1024     60.02  
   1280x960      60.00  
   1368x768      60.00  
   1280x720      60.00  
   1024x768      60.00  
   1024x576      60.00  
   960x540       60.00  
   800x600       60.32    56.25  
   864x486       60.00  
   640x480       59.94  
   720x405       60.00  
   640x360       60.00  

(UI elements too big on X)

External monitor:
DP2-2 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 290mm
   1920x1080     60.00*+  50.00    59.94  
   1680x1050     59.88  
   1400x1050     59.95  
   1600x900      60.00  
   1280x1024     75.02    60.02  
   1440x900      59.90  
   1280x960      60.00  
   1280x800      59.91  
   1152x864      75.00  
   1280x720      60.00    50.00    59.94  
   1024x768      75.03    70.07    60.00  
   832x624       74.55  
   800x600       72.19    75.00    60.32    56.25  
   720x576       50.00  
   720x480       60.00    59.94  
   640x480       75.00    72.81    66.67    60.00    59.94  
   720x400       70.08  

(All good)

If I run calibre without having external monitor connected, it is broken in a different way (UI elements still too big but not as much as if it's launched with connected external monitor and then placed to laptop screen).

Comment 13 Marco Kundt 2016-10-22 12:38:25 UTC
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
eDP1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 280mm x 160mm
   1920x1080     60.04*+
   1400x1050     59.98  
   1600x900      60.00  
   1280x1024     60.02  
   1280x960      60.00  
   1368x768      60.00  
   1280x720      60.00  
   1024x768      60.00  
   1024x576      60.00  
   960x540       60.00  
   800x600       60.32    56.25  
   864x486       60.00  
   640x480       59.94  
   720x405       60.00  
   640x360       60.00

Comment 14 Jan Grulich 2016-10-24 06:20:41 UTC
I wasn't able to reproduce this on Fedora 25 with any of my 1080p monitors (laptop 15", 23" and 24"). Did you increase font scaling or you didn't touch any scaling at all? What happens if you switch to another QPA, e.g using "export QT_QPA_PLATFORMTHEME=gtk3"?

Comment 15 Jan Grulich 2016-10-24 06:32:14 UTC
Btw. looks that both Calibre and Spyder are written in PyQt4, which means they are not affected by any QPA (including qgnomeplatform). Regarding seafile-client, I wasn't able to find the source code for that, but I found in changelog they handle HiDPI themself and maybe break it somehow. Would be nice to test your problems with any other Qt5 application, like dolphin from KDE.

Comment 16 František Zatloukal 2016-10-24 12:06:53 UTC
(In reply to Jan Grulich from comment #15)
> Btw. looks that both Calibre and Spyder are written in PyQt4, which means
> they are not affected by any QPA (including qgnomeplatform).

Interesting but:
if I run calibre/spyder with QT_QPA_PLATFORM=wayland-egl:
    decorations are "broken" (some blue qt style)
    I see that application as native Wayland window (checked through looking glass in gnome)
    scaling is working fine

without that:
    decorations are inherited from gtk theme
    scaling is broken
    app is running under XWayland (looking glass)

I forgot to mention that I am using spyder from PIP (so it's compiled with PyQT5). But calibre is from Fedora repositories (I've built src.rpm from f26).

Comment 17 Marco Kundt 2016-10-24 12:14:44 UTC
(In reply to Jan Grulich from comment #14)
> I wasn't able to reproduce this on Fedora 25 with any of my 1080p monitors
> (laptop 15", 23" and 24"). Did you increase font scaling or you didn't touch
> any scaling at all? What happens if you switch to another QPA, e.g using
> "export QT_QPA_PLATFORMTHEME=gtk3"?

I was using plain GNOME, no modifications to the QT_QPA_PLATFORMTHEME variable. So, i think it was set to 'gnome' since it's the default behaviour? The scaling wasn't changed at all.

Comment 18 Marco Kundt 2016-10-24 12:20:02 UTC
(In reply to Marco Kundt from comment #17)
> (In reply to Jan Grulich from comment #14)
> > I wasn't able to reproduce this on Fedora 25 with any of my 1080p monitors
> > (laptop 15", 23" and 24"). Did you increase font scaling or you didn't touch
> > any scaling at all? What happens if you switch to another QPA, e.g using
> > "export QT_QPA_PLATFORMTHEME=gtk3"?
> 
> I was using plain GNOME, no modifications to the QT_QPA_PLATFORMTHEME
> variable. So, i think it was set to 'gnome' since it's the default
> behaviour? The scaling wasn't changed at all.

I forgot to mention that i switched back to my previous distro/install. Maybe František can try the value 'gtk3' for the variable. I will again try when F25 was released.

Comment 19 Kamil Páral 2016-10-25 13:19:42 UTC
I can easily reproduce this using mediawriter package (or vlc). On laptop screen, QT apps are too big. On external screen, everything is fine. On a second external screen, everything is fine until I rotate it, then apps are resized a bit. All screens are 1920x1080.

$ xrandr 
Screen 0: minimum 320 x 200, current 4920 x 1920, maximum 8192 x 8192
XWAYLAND1 connected 1920x1080+1920+0 510mm x 290mm
   1920x1080     59.96*+
XWAYLAND6 connected 1080x1920+3840+0 510mm x 290mm
   1080x1920     59.96*+
XWAYLAND7 connected 1920x1080+0+0 310mm x 170mm
   1920x1080     59.96*+

Comment 20 Kamil Páral 2016-10-25 13:20:50 UTC
Created attachment 1213902 [details]
mediawriter laptop vs external screen

This shows mediawriter changes when moving between laptop and external screen.

Comment 21 Kamil Páral 2016-10-25 13:23:03 UTC
Created attachment 1213904 [details]
mediawriter with QT_QPA_PLATFORM=wayland-egl

The same approach using QT_QPA_PLATFORM=wayland-egl means the window is too big everywhere (doesn't change sizes).

(btw, QT_QPA_PLATFORMTHEME=gtk3 has no effect, neither does removing qgnomeplatform)

Comment 22 Kamil Páral 2016-10-25 13:23:52 UTC
Created attachment 1213905 [details]
mediawriter on 2 external monitors

When using 2 external monitors, mediawriter does not change size when moving between them (all is OK).

Comment 23 Kamil Páral 2016-10-25 13:25:04 UTC
Created attachment 1213906 [details]
mediawriter on 2 external monitors when 1 is rotated

But when one of the 2 external monitors is rotated, mediawriter starts to change size slightly.

Comment 24 Kamil Páral 2016-10-25 13:26:22 UTC
gnome-shell-3.22.1-2.fc25.x86_64
gtk3-3.22.2-1.fc25.x86_64
mediawriter-3.97.2-0.fc25.x86_64
mutter-3.22.1-5.fc25.x86_64
qgnomeplatform-0.2-10.20161024git.fc25.x86_64
qt5-qtbase-5.7.0-3.fc25.x86_64

Comment 25 Jan Grulich 2016-10-26 05:19:19 UTC
Don't take mediawriter into account as it tries to scale the UI itself if I'm not wrong.

Right now we have confirmed that the scaling is broken for PyQt applications, VLC and seafile-client (which we don't know how is implemented). Please try some KDE applications (e.g. dolphin, kcalc, gwenview) which don't try to implement the scaling themself or they are not written in Python.

Comment 26 Kamil Páral 2016-10-26 08:27:52 UTC
I don't see any issues with dolphin, kcalc or gwenview.

Comment 27 Martin Bříza 2016-11-01 14:34:32 UTC
So after some debugging I have some remarks about this.
First, this bug appears only in the applications that have set the AA_EnableHighDpiScaling QApplication flag, which is just a fraction of all Qt applications - this applies to VLC, Calibre and Fedora Media Writer 4.0.0 for example (FMW versions below 4 didn't use this flag).
The biggest part of it lies in the fact Qt considers every display of DPI above 144 a highDPI display, so it sets up 2x scaling.
Another problem, though, is how it actually scales the application on different displays. It seems to compare the DPIs of the screens and scale the app further using the ratio between these two. That seems to be the reason Frantisek's applications had so small fonts, etc.

I think it would be a good start to change the scaling threshold to 192 to match the threshold of GNOME application scaling.

Comment 28 Martin Kourim 2016-12-09 11:31:31 UTC
It's possible to workaround this issue by setting QT_SCALE_FACTOR=1 (when launching the application, in ~/.bash_profile, etc.)

Comment 29 Geert Warrink 2016-12-09 16:15:45 UTC
With the recent update of Calibre and the qt5 libraries in Fedora 24, the problem is now also present in this release of Fedora.

Comment 30 Marco Kundt 2016-12-21 11:26:33 UTC
After a installing the Fedora 25 (completly new, no in-place upgrade) i'm experiencing the same behaviour with at least seafile under Wayland. QT_SCALE_FACTOR=1 command doesn't work either (see last attachment).

Comment 31 Marco Kundt 2016-12-21 11:28:10 UTC
Created attachment 1234302 [details]
Seafile-client on Fedora 25 w/ Wayland

Comment 32 sac 2016-12-26 14:48:20 UTC
>I think it would be a good start to change the scaling threshold to 192 to match the threshold of GNOME application scaling.

Seems this is really related to QT (guess the component bug should be re-assigned). In KDE Neon / Kubuntu I'm experiencing exactly the same if Wayland is used ( https://blog.martin-graesslin.com/blog/2016/05/running-plasma-wayland-on-kde-neon/ ). There all QT apps, including the system settings don't even fit on my 1920x1080 screen tablet. The task bar and window controls are fine, but all symbols, fonts & GUI elements from QT are totally unusable.

Comment 33 sac 2017-01-03 19:56:33 UTC
Created attachment 1236979 [details]
Fedora25_Gnome_Applications_Scaled_And_Unusable

E.g. Terminal & system settings don't even fit on a 11" Dell Venue 11 Pro FullHD 1920x1080, because they're upscaled that big.

Comment 34 sac 2017-01-03 21:49:04 UTC
If I change the resolution from 1920x1080 to 1600x900, at least Fedora & GTK Gnome apps are correctly scaled and usable again, Calibre can be used with the "QT_SCALE_FACTOR=1 calibre" workaround. Tested with the original Fedora 25 Live image (same happened to my original Fedora installation after the ugrade to 25, if the resolution is not lowered Fedora becomes unusable on a small FullHD screen).

But there's definitely sth. really messed up currently.

Comment 35 Martin Bříza 2017-01-04 09:06:38 UTC
(In reply to sac from comment #33)
> Created attachment 1236979 [details]
> Fedora25_Gnome_Applications_Scaled_And_Unusable
> 
> E.g. Terminal & system settings don't even fit on a 11" Dell Venue 11 Pro
> FullHD 1920x1080, because they're upscaled that big.

Those are GNOME applications though. Seemingly the same, unfortunately though a different problem that should be tracked elsewhere.

Comment 36 Marco Kundt 2017-01-21 16:02:59 UTC
For the Seafile-client there is already an issue (https://github.com/haiwen/seafile-client/issues/809) and I let them know what the culprit is. I hope they revert the auto scale feature until QT changes the hiDPI threshold or nearly everyone has real hiDPI display.

Comment 37 Martin Bříza 2017-01-24 10:44:34 UTC
Created attachment 1243871 [details]
Proposed fix

This patch moves the threshold for 2x scaling from the DPI of 144 to 192, the same value GNOME uses. It's not a complete solution, however it will improve the behavior for most people and will make Qt applications act the same as GTK3.

Comment 38 Rex Dieter 2017-01-24 16:06:17 UTC
Triaging to qt5-qtbase component, and applying the proposed patch

Comment 39 Marco Kundt 2017-01-24 19:00:18 UTC
I just installed the freshly build qt5-qtbase packages and the patch works for me as expected. The seafile-client is scaled right without any env-variables. Thank you very much.

Comment 40 Fedora Update System 2017-01-24 19:06:24 UTC
qt5-qtbase-5.7.1-13.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-d991dd7e59

Comment 41 Fedora Update System 2017-01-28 19:20:50 UTC
qt5-qtbase-5.7.1-13.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-d991dd7e59

Comment 42 Fedora Update System 2017-02-10 14:20:32 UTC
qt5-qtbase-5.7.1-13.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 43 Dmitry Tantsur 2017-02-10 15:28:55 UTC
cutegram still looks ugly, and QT_SCALE_FACTOR=1 only solves fonts. I guess they may be using their own logic..

Comment 44 Geert Warrink 2017-07-15 12:23:33 UTC
The scaling problem with Calibre and e-book viewer is back in Fedora 26.

Comment 45 Kseniya 2017-08-14 19:26:23 UTC
On Fedora 26 I have crazy big interface fonts with VLC. 
Subtitle fonts and interface in general look ok. QT_SCALE_FACTOR=1 only resizes the window, no impact on interface or fonts.
However everything looks nice with an external monitor connected.

Comment 46 Rex Dieter 2017-08-14 20:20:54 UTC
I suspect your 2 screens may have (very) different dpi

Comment 47 Ian Laurie 2017-10-15 03:22:39 UTC
Entertainment system is Fedora 26 with a large sized Samsung TV as a monitor (but only 1080p) I have crazy interface in VLC, all tool bar buttons are at least 4 x their regular size.  Thankfully it will still play videos full screen but any GUI component, when visible, is crazy proportions.

Comment 48 Fedora End Of Life 2017-11-16 18:43:46 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 49 Dmitry Tantsur 2017-11-17 11:02:49 UTC
Apparently still valid for F26, I can reproduce it only openshot-qt, see also comment 45

Comment 50 Geert Warrink 2017-11-17 11:24:24 UTC
The problem is also valid for F27, I can reproduce it with Calibre and rhe ebook reader.

Comment 51 Fedora End Of Life 2018-05-03 08:01:04 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 52 Fedora End Of Life 2018-05-29 11:46:56 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 53 Thomas Pi. 2018-06-22 14:08:52 UTC
Stil exists in Fedora 27 and Fedora 28. Everything started this week. Upgrade to Fedora to version 28 does not fixed anything. 
QT_SCALE_FACTOR=1 fixes the problem for me for applications started from the console.