[Interest] Question about correct way to initialize HiDPI support

Christoph Cullmann christoph at cullmann.io
Mon Jan 13 10:34:42 CET 2020


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

-- 
Ignorance is bliss...
https://cullmann.io | https://kate-editor.org


More information about the Interest mailing list