Qt Quick Controls 2 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 2.
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: