From 359ba4c0700ff43a68ad62517bf7c638c341be8a Mon Sep 17 00:00:00 2001 From: Méven Car Date: Mon, 9 Mar 2026 11:46:14 +0100 Subject: information/pixmapviewer: handle hdipi for animated images BUG: 510829 --- src/panels/information/pixmapviewer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/panels/information/pixmapviewer.cpp') diff --git a/src/panels/information/pixmapviewer.cpp b/src/panels/information/pixmapviewer.cpp index 9ac9bd253..4f3f9e82f 100644 --- a/src/panels/information/pixmapviewer.cpp +++ b/src/panels/information/pixmapviewer.cpp @@ -54,6 +54,7 @@ void PixmapViewer::setPixmap(const QPixmap &pixmap) void PixmapViewer::setSizeHint(const QSize &size) { if (m_animatedImage && size != m_sizeHint) { + m_animatedImage->setScaledSize(QSize()); m_animatedImage->stop(); } @@ -104,10 +105,12 @@ void PixmapViewer::updateAnimatedImageFrame() Q_ASSERT(m_animatedImage); m_pixmap = m_animatedImage->currentPixmap(); - if (m_pixmap.width() > m_sizeHint.width() || m_pixmap.height() > m_sizeHint.height()) { - m_pixmap = m_pixmap.scaled(m_sizeHint, Qt::KeepAspectRatio); + const auto physicalSize = m_sizeHint * devicePixelRatio(); + if (m_pixmap.width() > physicalSize.width() || m_pixmap.height() > physicalSize.height()) { + m_pixmap = m_pixmap.scaled(physicalSize, Qt::KeepAspectRatio); m_animatedImage->setScaledSize(m_pixmap.size()); } + m_pixmap.setDevicePixelRatio(devicePixelRatio()); update(); } -- cgit v1.3