<QT>预览界面与实际输出界面不一样

文章提到,QT在处理高分辨率屏幕时可能出现像素上的偏差。为了解决这个问题,可以在main函数第一行添加特定代码:如果QT版本大于等于5.6.0,设置QCoreApplication的属性Qt::AA_EnableHighDpiScaling。这样可以启用高DPI缩放,从而修正显示问题。
摘要由CSDN通过智能技术生成

(这是由于QT对于高分辨率的屏幕存在像素上的偏差)

 在main函数第一行加上以下代码

if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
           QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

加上这句后问题解决

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>Client</class> <widget class="QDialog" name="Client"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>396</width> <height>196</height> </rect> </property> <property name="windowTitle"> <string>Dialog</string> </property> <widget class="QPushButton" name="cCancleBtn"> <property name="geometry"> <rect> <x>180</x> <y>150</y> <width>75</width> <height>23</height> </rect> </property> <property name="text"> <string>取消</string> </property> </widget> <widget class="QPushButton" name="cCloseBtn"> <property name="geometry"> <rect> <x>280</x> <y>150</y> <width>75</width> <height>23</height> </rect> </property> <property name="text"> <string>关闭</string> </property> </widget> <widget class="QLabel" name="cStatusLbl"> <property name="geometry"> <rect> <x>60</x> <y>110</y> <width>131</width> <height>16</height> </rect> </property> <property name="text"> <string>等待接收文件...</string> </property> </widget> <widget class="QLabel" name="label_2"> <property name="geometry"> <rect> <x>60</x> <y>60</y> <width>54</width> <height>12</height> </rect> </property> <property name="text"> <string>已完成</string> </property> </widget> <widget class="QProgressBar" name="progressBar"> <property name="geometry"> <rect> <x>110</x> <y>50</y> <width>271</width> <height>23</height> </rect> </property> <property name="value"> <number>0</number> </property> </widget> </widget> <resources/> <connections/> </ui>紧扣该段代码,介绍其界面的设计基本原则
06-10
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

-breezeyy-

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值