[Development] Updated high-DPI support for Qt 5.14

Thiago Macieira thiago.macieira at intel.com
Fri Sep 27 22:07:12 CEST 2019


On Friday, 27 September 2019 10:51:00 PDT Morten Sørvig wrote:
> > The problem on that one is that you're forcing me to keep a value per each
> >  individual monitor I connect to regularly. With the laptop's display
> > panel, that's 4 or 5. Since they are different actual monitors, each has
> > their own DPI value, which is obtained by Qt. And some monitors report
> > wildly incorrect DPI values, like a 27" monitor saying it's 160x90mm in
> > size. So what's the policy for a brand new monitor we connect to (say, a
> > projector in a conference room)? Does it:
> > a) keep the physical one from the monitor? 
> > b) use 96x96? 
> > c) use one of the other monitor's settings? 
> > (hint: a, b and c are wrong)
> > 
> > Right now, I need exactly two values: the display panel's multiplicative 
> > factor of 2 and the external output's multiplicative factor of 2.
> 
> 
> Right, I think I see what you are doing now (maybe). But what about non-Qt
> apps? Do you configure them manually as well?

 $ xdpyinfo | grep dots
  resolution:    217x217 dots per inch
 $ cat ~/.config/plasma-workspace/env/var.sh
export CLUTTER_SCALE=2
export GDK_BACKEND=x11
#export GDK_SCALE=2
export LDAPTLS_CACERT=/etc/ssl/ca-bundle.pem
#export LD_LIBRARY_PATH=$HOME/lib
#export QT_MESSAGE_PATTERN='[%{time boot}] %{appname}(%{pid} %{threadid}):%
{if-category} %{category}:%{endif}   %{message}'
export QT_SCREEN_SCALE_FACTORS='2;2'
$ cat ~/.config/startupconfig
#! /bin/sh
# kcminputrc Mouse cursorTheme 'breeze_cursors'
kcminputrc_mouse_cursortheme=breeze_cursors
# kcminputrc Mouse cursorSize ''
kcminputrc_mouse_cursorsize=''
# ksplashrc KSplash Theme Breeze
ksplashrc_ksplash_theme=Breeze
# ksplashrc KSplash Engine KSplashQML
ksplashrc_ksplash_engine=KSplashQML
# kdeglobals KScreen ScaleFactor ''
kdeglobals_kscreen_scalefactor=1
# kdeglobals KScreen ScreenScaleFactors ''
kdeglobals_kscreen_screenscalefactors=''
# kcmfonts General forceFontDPI 0
kcmfonts_general_forcefontdpi=0
 $ grep -Fe '[Desktop' -e Exec ~/.local/share/applications/google-
chrome.desktop
[Desktop Action NewPrivateWindow]
Exec=/usr/bin/google-chrome-stable --incognito
[Desktop Action NewWindow]
Exec=/usr/bin/google-chrome-stable
[Desktop Entry]
Exec=/usr/bin/google-chrome-stable --force-device-scale-factor=2.25 %U

The GDK scale I had turn off because otherwise it conflict with how Qt scales. 
My system is set to 216 dpi, which means fonts are the right size. But if I 
set the GDK scale, it scales the fonts *again* so I get huge screens. So I'm 
setting for readable GTK text with tiny icons.

Firefox seems to work fine and has right-sized icons. Google Chrome is scaled 
to 225%.

> If this logic could be contained within the XCB platform plugin, and the
> result reported to QtGui via QPlatformScreen::logicalDpi(), then I would
> be happy. (And, setHighDpiScaleFactorRoundingPolicy could work as
> documented, too). 

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products






More information about the Development mailing list