┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/information/pixmapviewer.cpp
diff options
context:
space:
mode:
authorIsmael Asensio <[email protected]>2025-07-06 15:08:48 +0200
committerIsmael Asensio <[email protected]>2025-07-13 12:24:01 +0200
commitefd4a2acb681a0766d59d5cfb0bcbfb7fc389309 (patch)
treeb87bf7d39b2787494ef583bc5e5d72a8cb0faff4 /src/panels/information/pixmapviewer.cpp
parent43cc016f8b3ec48157a86815a050518a41b423b2 (diff)
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
Diffstat (limited to 'src/panels/information/pixmapviewer.cpp')
-rw-r--r--src/panels/information/pixmapviewer.cpp5
1 files changed, 5 insertions, 0 deletions
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();
}