[QGIS-Developer] Incorrect hidpi setting in 3.0 for OSX

Nyall Dawson nyall.dawson at gmail.com
Mon Feb 19 14:19:07 PST 2018


On 20 February 2018 at 01:26, Alessandro Pasotti <apasotti at gmail.com> wrote:
> It's rather obscure to me too :)
>
> For Qt 5.10 on Linux I use
>
> QT_AUTO_SCREEN_SCALE_FACTOR to 0
> QT_DEVICE_PIXEL_RATIO to 1
>
>
> but on the same machine and display with Qt 5.9.3 I need to use
>
> QT_AUTO_SCREEN_SCALE_FACTOR to 1
> QT_DEVICE_PIXEL_RATIO to 2
>
>
> in order to have the same effect, that is the SVG icons are not pixelated
> neither are the Qt GUI elements (like checkboxes) which are actually too
> small.
>
>
> If I set QT_AUTO_SCREEN_SCALE_FACTOR to 1 QT_DEVICE_PIXEL_RATIO to 2 on 5.10
> I get the correct size for the Qt GUI elements but I get pixelated SVG
> icons.
>
>
> I've not yet found the perfect solution.

I think this whole thing is a mess :P

I believe the correct  solution (on QGIS side) is to use a device
pixel ratio of 1, i.e. a pixel is a pixel and don't do any tricks to
try to automatically handle this. And then we should avoid all
hardcoded pixel sizes and just use sizes relative to font metrics.
Which is what we've done a lot of for 3.0, but there's still work to
do.

I think the OSX builds are auto-setting the pixel ratio to 2 somewhere
(it's not in the qgis code -- so maybe it's in the homebrew package or
something. I dunno... the mess which is OSX package repos makes even
npm look stable and a joy to use by comparison).

What I can't work out is why Qt widgets themselves badly handle hidpi
screens. E.g. a QDockWidget on hidpi has a TINY close button. I think
that needs fixing in Qt itself though, and until they do we just learn
to squint... but we DON'T try to hack around it using the pixel ratio
settings.

I also can't work out how to automatically scale layout
padding/margins by font metrics. It seems a huge endeavour to manually
set all these... yet without doing so the layouts on hidpi look very
cramped because widgets a smooshed up against each other with barely
any padding.

Bah. I wish my laptop could run natively in a low dpi mode with the
correct aspect ratio. I'd just do that until Qt gets its mess sorted
out.

Nyall*


* Feeling very much like a grumpy old "get off my lawn" type guy.
Maybe it's because the photos from Madiera are starting to flow in on
social media...


More information about the QGIS-Developer mailing list