windows实际分辨率, 1920x1080
显示窗体w大小:800x600
100缩放率:
关闭Qt::AA_EnableHighDpiScaling
ui->pushButton->size() QSize(114, 30)
"\\\\.\\DISPLAY1"
devicePixelRatio 1
geometry QRect(0,0 1920x1080)
virtualGeometry QRect(0,0 1920x1080)
size QSize(1920, 1080)
virtualSize QSize(1920, 1080)
logicalDotsPerInch 96
scale: 1
开启Qt::AA_EnableHighDpiScaling
ui->pushButton->size() QSize(114, 30)
"\\\\.\\DISPLAY1"
devicePixelRatio 1
geometry QRect(0,0 1920x1080)
virtualGeometry QRect(0,0 1920x1080)
size QSize(1920, 1080)
virtualSize QSize(1920, 1080)
logicalDotsPerInch 96
scale: 1
125缩放率:
关闭Qt::AA_EnableHighDpiScaling
ui->pushButton->size() QSize(114, 30)
"\\\\.\\DISPLAY1"
devicePixelRatio 1
geometry QRect(0,0 1920x1080)
virtualGeometry QRect(0,0 1920x1080)
size QSize(1920, 1080)
virtualSize QSize(1920, 1080)
logicalDotsPerInch 120
scale: 1.25
w.size() QSize(800, 600)
开启Qt::AA_EnableHighDpiScaling
ui->pushButton->size() QSize(114, 30)
"\\\\.\\DISPLAY1"
devicePixelRatio 1
geometry QRect(0,0 1920x1080)
virtualGeometry QRect(0,0 1920x1080)
size QSize(1920, 1080)
virtualSize QSize(1920, 1080)
logicalDotsPerInch 120
scale: 1.25
w.size() QSize(800, 600)
150缩放率:
关闭Qt::AA_EnableHighDpiScaling
ui->pushButton->size() QSize(114, 30)
devicePixelRatio 1
geometry QRect(0,0 1920x1080)
virtualGeometry QRect(0,0 1920x1080)
size QSize(1920, 1080)
virtualSize QSize(1920, 1080)
logicalDotsPerInch 144
scale: 1.5
开启Qt::AA_EnableHighDpiScaling
ui->pushButton->size() QSize(114, 30)
devicePixelRatio 2
geometry QRect(0,0 960x540)
virtualGeometry QRect(0,0 960x540)
size QSize(960, 540)
virtualSize QSize(960, 540)
logicalDotsPerInch 96
scale: 1
看来会按照 devicePixelRatio 去把屏幕大小做了缩小
175缩放率:
关闭Qt::AA_EnableHighDpiScaling
ui->pushButton->size() QSize(114, 30)
"\\\\.\\DISPLAY1"
devicePixelRatio 1
geometry QRect(0,0 1920x1080)
virtualGeometry QRect(0,0 1920x1080)
size QSize(1920, 1080)
virtualSize QSize(1920, 1080)
logicalDotsPerInch 168
scale: 1.75
开启Qt::AA_EnableHighDpiScaling
ui->pushButton->size() QSize(114, 30)
"\\\\.\\DISPLAY1"
devicePixelRatio 2
geometry QRect(0,0 960x540)
virtualGeometry QRect(0,0 960x540)
size QSize(960, 540)
virtualSize QSize(960, 540)
logicalDotsPerInch 96
scale: 1
下面这种方法待尝试
使用qt.conf,在资源qrc里添加,qt/etc/qt.conf, qt.conf文件内容为:
[Platforms][Platforms]
WindowsArguments = dpiawareness=0
https://blog.csdn.net/startl/article/details/105862817
https://doc.qt.io/qt-5/highdpi.html
https://doc.qt.io/qt-6/highdpi.html
Lower-level graphics drawing (such as OpenGL code) need to be high-DPI aware, but can use cross platform Qt APIs to learn about the platform's display resolutions.
但是dpi aware情况下,控件显示异常怎么解决?
标签:QRect,QSize,Qt,缩放,Windows,1080,1920,1920x1080,size From: https://www.cnblogs.com/cute/p/16800130.html