fix: blurry icons and images when build with Qt 5

This fix the issue that the icons on sidebar and the mascot on about
dialog is blurry.
This commit is contained in:
Wang Zichong
2026-01-15 13:27:52 +08:00
parent 3623850f63
commit 60b379268d
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++ 编译器优化 int fakeArgc = argc + 2; // QCoreApplication 的 argc 要用引用,避免 c++ 编译器优化
Application a(fakeArgc, fakeArgs.data()); 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); a.setBuildDateTime(buildDateTime);

View File

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