Proportion Issue for Qt High-dpi Scaling



  • Hi there:

    I have an issue about the proportion of Qt high-dpi scaling. I am using Qt 5.7.0 for Windows 64-bit (VS 2015) under a 64-bit Windows 10.

    Please refer to attached pictures - Screenshot 1 and Screenshot 2 - with details there. What can I do to solve the proportion issue? Please help.
    Screenshot 1
    Screenshot 2

    1. I just called QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); in main.cpp

    2. main.cpp is as the following:
      #include "mainwindow.h"
      #include <QApplication>

    int main(int argc, char *argv[])
    {
    QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);

    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    
    return a.exec();
    

    }

    1. mainwindow.cpp is as the following:
      #include "mainwindow.h"
      #include "ui_mainwindow.h"

    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.