From 657326993ebab31ffa3538ae09ec0f73d21f0545 Mon Sep 17 00:00:00 2001 From: Hillwood Yang Date: Sat, 19 Oct 2024 23:11:05 +0800 Subject: [PATCH] feat: Support Qt 6.8 Log: Fix build on Qt 6.8 --- src/widgets/dlabel.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/widgets/dlabel.cpp b/src/widgets/dlabel.cpp index ae53c06de..c00936fb5 100644 --- a/src/widgets/dlabel.cpp +++ b/src/widgets/dlabel.cpp @@ -262,6 +262,7 @@ void DLabel::paintEvent(QPaintEvent *event) if (d->scaledcontents) { QSize scaledSize = cr.size() * devicePixelRatioF(); if (!d->scaledpixmap || d->scaledpixmap->size() != scaledSize) { +#if QT_VERSION < QT_VERSION_CHECK(6, 8, 0) if (!d->cachedimage) #if QT_VERSION < QT_VERSION_CHECK(6, 4, 2) d->cachedimage = new QImage(d->pixmap->toImage()); @@ -272,11 +273,17 @@ void DLabel::paintEvent(QPaintEvent *event) #endif QImage scaledImage = d->cachedimage->scaled(scaledSize, +#else + d->scaledpixmap.reset(); + d->scaledpixmap = d->pixmap->scaled(scaledSize, +#endif Qt::IgnoreAspectRatio, Qt::SmoothTransformation); +#if QT_VERSION < QT_VERSION_CHECK(6, 8, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 4, 2) d->scaledpixmap = new QPixmap(QPixmap::fromImage(scaledImage)); #else d->scaledpixmap = QPixmap(QPixmap::fromImage(scaledImage)); +#endif #endif d->scaledpixmap->setDevicePixelRatio(devicePixelRatioF()); }