Why the application cannot scale on high DPI screen?

Viewed 535

I'm developing an application using qt on laptop with 125% scaling. I searched web ways to scale application. I'm used:

  • QT_AUTO_SCREEN_SCALE_FACTOR=true
  • QT_ENABLE_HIGHDPI_SCALING=true
  • QT_SCALE_FACTOR=1
  • QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

No one of this ways have no effect.

QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); located in main function:

#include "mainwindow.h"

#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); //It is here.
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}

QtCreator 4.13.2, Qt 5.15.1, MSVC2019 64bit debug.

1 Answers

I'm restarted Qt and scaling starts working. Also restart needed after edit of evironment variables.

Related