[Development] Confused about HiDPI scaling and fonts
Thomas Laguzzi
tholag at gmail.com
Mon Feb 8 10:17:15 CET 2021
Hello,
I'm trying to enable QT_ENABLE_HIGHDPI_SCALING=1 in a windows application.
It seems to work good in a multi-screen application even with different DPI
settings, but it only resizes the widgets.
The fonts always remain the same size (100% scaling).
Is there a way to use QT_ENABLE_HIGHDPI_SCALING and automatic font resize?
If I have to do manually, how to detect screen changes?
If I use QT_SCALE_FACTOR it resizes correctly both the widgets and fonts,
but once the application is started it cannot be changed anymore.
I use something like:
qputenv("QT_ENABLE_HIGHDPI_SCALING","1");
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
QApplication a(argc, argv);
MainWindow w;
w.show();
thanks for any hint!
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20210208/c7eb8010/attachment.html>
More information about the Development
mailing list