[Interest] High DPI support in QT (Windows)
Sorvig Morten
Morten.Sorvig at theqtcompany.com
Wed Sep 23 13:01:13 CEST 2015
Hi,
Behind the scenes the new 5.6 support is actually a rewrite, where we have moved the implementation from the platform plugins to QtGui.
The user-visible changes are the environment variables:
QT_DEVICE_PIXEL_RATIO: deprecated, and replaced by
QT_SCALE_FACTOR: which takes a numeric scale factor, and
QT_AUTO_SCREEN_SCALE_FACTOR: (bool) reads the OS settings on X11 and Windows.
There is no corresponding C++ API for applications at this point. One way around that is to call qputenv() as the very first thing in main().
I’m not too familiar with the Windows particulars. I can answer general questions about High DPI support if there are any.
Morten
> On 21 Sep 2015, at 19:52, Pavlo Dyachenko <upavlo at gmail.com> wrote:
>
> Yes, it seems that there are some minor improvements, however QT_SCALE_FACTOR variable still only supports numeric values.
>
> On 21 September 2015 at 16:36, Adam Light <aclight at gmail.com> wrote:
>
>
> On Fri, Sep 18, 2015 at 1:38 AM, Pavlo Dyachenko <upavlo at gmail.com> wrote:
> Hi QT team, I posted a question on the forum about high DPI support but then was recommended this mailing list instead:
> According to documentation here http://doc.qt.io/qt-5/highdpi.html QT 5.4+ introduces high DPI support. However, either I’m missing something fundamental or the current support is still in very early stages. I’m writing a brand new application so I have a chance to do it right from the ground up. I understand that I would have to use layouts instead of fixed positioning etc, but there always going to be cases in which I would have to specify, for example a minimum/maximum size of a control. I can specify them in the editor, but these are device pixels. So if I change my Windows settings to use 150% DPI then min/max values in the editor would be too small. Of course I can obtain that ratio and adjust all the required values in code, but then what kind of high DPI support does QT give for me if I have to do everything by hand? I mean how is it different to pre QT 5.4?
>
> Then an interesting one is QT_DEVICE_PIXEL_RATIO environment variable. It does exactly what I need, it multiplies all pixels set in editor by a factor. But why is it an environment variable and not a per application setting? Why does it only support integer values of 2, 3 etc, since we know that Windows has settings like 125, 150% etc. and why couldn’t it automatically read the Windows setting and set itself to that value?
>
>
> Though I have not yet tried it, my understanding is that in Qt 5.6, the support for HiDPI has been improved. See https://doc-snapshots.qt.io/qt5-5.6/highdpi.html for the most recent documentation.
>
> Adam
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list