[Interest] Question about correct way to initialize HiDPI support

coroberti . coroberti at gmail.com
Mon Jan 13 11:35:49 CET 2020


On Mon, Jan 13, 2020 at 11:35 AM Christoph Cullmann
<christoph at cullmann.io> wrote:
>
> Hi,
>
> after reading https://doc.qt.io/qt-5/highdpi.html it is still a bit
> unclear to me,
> what is the correct sequence of attribute setting to have proper HiDPI
> support on the
> X11/Windows/macOS platforms (including support for scales like 150%).
>
> At the moment, e.g. in Kate, we try (before we init the QApplication):
>
>      /**
>       * enable high dpi support
>       */
>      QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
>      QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
>
>      /**
>       * allow fractional scaling
>       */
> #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
>
> QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
> #endif
>
> Is that actually the right way to do it?
>
> Does one actually need the Qt::AA_EnableHighDpiScaling call?
> We got some reports that we behave strangely (weird sizes) since we
> added Qt::AA_EnableHighDpiScaling.
>
> If I miss some example snippet in the documentation, any pointer is
> welcome ;=)
>
> Greetings
> Christoph

Hi,
I'm joining the question and would appreciate some kind of "Best Practices"
or guidelines for dummies, perhaps, platform-specific.

Thanks,
Robert


More information about the Interest mailing list