diff --git a/src/main.cpp b/src/main.cpp index 2da9621..273c431 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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); diff --git a/src/widgets/common/customlabel.cpp b/src/widgets/common/customlabel.cpp index 27b940e..4c9e51e 100644 --- a/src/widgets/common/customlabel.cpp +++ b/src/widgets/common/customlabel.cpp @@ -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)