I am developing on a 4k monitor and its a pain...
Finally I managed to set up QtDesigner and then ecountered this issue:
When you use QT_AUTO_SCREEN_SCALE_FACTOR=1
and compile an app with radiobutton and other basic widgets, it looks scaled on a 4k screen.
Otherwise the dimensions of controls are correct and as expected, its just not sharp, but rather pixelated.
I am running on Windows 10 Home 64bit on 4k screen with 200% DPI zoom, using Qt 5.6 RC msvc2015 64bit and tried with achieving the same results using
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
If I use
QGuiApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
the controls are sharp, text size is ok BUT all dimensions are much smaller.
How do I make controls sharp on high DPI screen?
With QT_AUTO_SCREEN_SCALE_FACTOR, the point size of the fonts are not changed, they're just scaled up from their original pixels, so they will never be smooth, only more bumpy.
Ref: http://doc.qt.io/qt-5.6/highdpi.html#high-dpi-support-in-qt "This will not change the size of point sized fonts"
You need to use QT_SCALE_FACTOR instead to rescale your app, not just rescale its pixels.
Here is what was working for me. You can set DPIawareness manually by giving a command line option at the instanciation of the QApplication.
The official documentation is here https://doc.qt.io/qt-5/highdpi.html (section DPI awareness).
According to the documentation, you can set the application to DPI Unaware (thus it will automatically scale but display will be blurred), or to System DPI Aware or to Per-Monitor Aware.
Here is a minimal example code for the instanciation of the QApplication to force High DPI, choose other value than 1 (0 or 2) to enable DPIUnaware or Per Monitor DPI Aware:
As Qt documentation says:
You can try doing what Qt Creator is doing:
Basically important thing is the last line
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
.