From: Ismael Asensio Date: Sun, 6 Jul 2025 13:08:48 +0000 (+0200) Subject: panels/information: Fix preview size for animated images X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/efd4a2acb681a0766d59d5cfb0bcbfb7fc389309 panels/information: Fix preview size for animated images If the image size is larger than the available size, we need to scale so it fits into the preview --- diff --git a/src/panels/information/pixmapviewer.cpp b/src/panels/information/pixmapviewer.cpp index 2767c87ea..b18c9e64e 100644 --- a/src/panels/information/pixmapviewer.cpp +++ b/src/panels/information/pixmapviewer.cpp @@ -144,6 +144,7 @@ void PixmapViewer::checkPendingPixmaps() update(); m_animation.start(); } else if (m_hasAnimatedImage) { + m_animatedImage->setScaledSize(m_pixmap.size()); m_animatedImage->start(); } else { m_oldPixmap = m_pixmap; @@ -155,6 +156,10 @@ 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); + m_animatedImage->setScaledSize(m_pixmap.size()); + } update(); }