《QDebug 2025年5月》

一、Qt Widgets 问题交流

1.开启PassThrough缩放后,QLabel在非百分百DPI缩放时显示图像模糊
cpp 复制代码
// QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); // 没影响
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // Qt5
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);

图片需要比Label尺寸大的,这样才能明显看到非百分百DPI缩放更模糊。

将QPixmap和QLabel的devicePixelRatioF同步后看起来就清晰了。

cpp 复制代码
qreal ratio = devicePixelRatioF();
QImage image = QImage(filepath).scaled(ui->label->size() * ratio, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap pixmap = QPixmap::fromImage(image);
pixmap.setDevicePixelRatio(ratio);
ui->label->setPixmap(pixmap);

QLabel使用grab保存图像,对比QPixmap设置devicePixelRatioF前后,可以看到设置前会有一些大的色块:

二、Qt Quick 问题交流

1.

三、其他

1.Inno Setup安装判断系统是32位还是64位

参考:https://developer.aliyun.com/article/258368

Setup

;先开启64位模式

ArchitecturesInstallIn64BitMode=x64

Run

;根据是否是64位进行不同的操作

Filename: "..."; Check: Is64BitInstallMode

Filename: "..."; Check: not Is64BitInstallMode

相关推荐
sycmancia6 小时前
Qt——多线程中的信号与槽(二)
jvm·qt
Quz1 天前
QML Label 完整用法与 Text 组件选型
前端·qt
kaixin_learn_qt_ing1 天前
QPluginLoader
qt
kaixin_learn_qt_ing1 天前
Qt 提升部件(Promote)找不到头文件路径
qt
秋田君2 天前
QT_QT布局详解
开发语言·数据库·qt
辞旧 lekkk2 天前
【Qt系统相关】鼠标事件
linux·开发语言·qt·学习·计算机外设·萌新
brave_zhao2 天前
什么是Qt Designer
开发语言·qt
贺国亚3 天前
A2A协议与Agent互操作-Task生命周期
开发语言·qt
luoyayun3613 天前
Qt + FFmpeg 视频工具:视频一键压缩功能实现
qt·ffmpeg·音视频·视频压缩
blueman88883 天前
Qt5通过vcpkg中调用时,在debug模式下调试时总是调用release的plugins文件夹中的dll
c++·qt·cmake