Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkwidget
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkwidget.

Source-pull-request: linuxdeepin/dtkwidget#612
  • Loading branch information
deepin-ci-robot authored and kegechen committed Oct 22, 2024
1 parent f9fd19d commit 9237ee9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/widgets/dlabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
}
Expand Down

0 comments on commit 9237ee9

Please sign in to comment.