【发布时间】:2021-02-14 19:52:15
【问题描述】:
我正在笔记本电脑上使用 qt 开发一个应用程序,可缩放 125%。我搜索了扩展应用程序的网络方法。我习惯了:
- QT_AUTO_SCREEN_SCALE_FACTOR=true
- QT_ENABLE_HIGHDPI_SCALING=true
- QT_SCALE_FACTOR=1
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
没有任何一种方法无效。
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 位于主函数中:
#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 64 位调试。
【问题讨论】:
-
不知道为什么,重启qt后,只有QT_SCALE_FACTOR=1.25开始工作。但它看起来很丑,其他方法一直不起作用。
标签: c++ qt user-interface