On this page
High-DPI Support in Qt Quick Controls
Qt Quick Controls support Qt's cross-platform high-DPI scaling introduced in Qt 5.6. The feature is opt-in, and can be enabled by setting the Qt::AA_EnableHighDpiScaling
application attribute in C++ before QGuiApplication is constructed:
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // <--
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}
Alternatively, an environment variable QT_AUTO_SCREEN_SCALE_FACTOR=1
can be set to enable automatic high-DPI scaling.
Warning: Qt Quick Controls 1.x are not compatible with Qt's automatic high-DPI scaling. There is currently no available solution for high-DPI support in applications wishing to mix Qt Quick Controls and Qt Quick Controls.
Related Information
© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-5.14/qtquickcontrols2-highdpi.html