!378 fix: blurry icons and images when build with Qt 5

Merge pull request !378 from BLumia/fix-blurry
This commit is contained in:
2026-01-19 11:34:52 +00:00
committed by Gitee
2 changed files with 7 additions and 0 deletions

View File

@@ -180,6 +180,9 @@ int main(int argc, char *argv[])
}
int fakeArgc = argc + 2; // QCoreApplication 的 argc 要用引用,避免 c++ 编译器优化
Application a(fakeArgc, fakeArgs.data());
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
a.setAttribute(Qt::ApplicationAttribute::AA_UseHighDpiPixmaps);
#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// 设置版本和构建时间
a.setBuildDateTime(buildDateTime);

View File

@@ -10,7 +10,11 @@ CustomLabel::CustomLabel(QWidget *parent,
QPixmap CustomLabel::pixmap() const
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return *QLabel::pixmap();
#else
return QLabel::pixmap();
#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
}
void CustomLabel::setPixmap(const QPixmap &pixmap)