From 9237ee9289f89e90e86c43a1faefdb598b6042c9 Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Sat, 19 Oct 2024 15:12:23 +0000 Subject: [PATCH] sync: from linuxdeepin/dtkwidget Synchronize source files from linuxdeepin/dtkwidget. Source-pull-request: https://github.com/linuxdeepin/dtkwidget/pull/612 --- 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()); }