return;
}
- // Avoid flicker with static pixmap if an animated image is running
- if (m_animatedImage) {
- m_animatedImage->setScaledSize(pixmap.size());
- if (m_animatedImage->state() == QMovie::Running) {
- return;
- }
- }
-
if ((m_transition != NoTransition) && (m_animation.state() == QTimeLine::Running)) {
m_pendingPixmaps.enqueue(pixmap);
if (m_pendingPixmaps.count() > 5) {
m_oldPixmap = m_pixmap.isNull() ? pixmap : m_pixmap;
m_pixmap = pixmap;
+
+ // Avoid flicker with static pixmap if an animated image is running
+ if (m_animatedImage && m_animatedImage->state() == QMovie::Running) {
+ return;
+ }
+
update();
const bool animateTransition = (m_transition != NoTransition) && (m_pixmap.size() != m_oldPixmap.size());
}
if (m_animatedImage->fileName() != fileName) {
- m_animatedImage->stop();
m_animatedImage->setFileName(fileName);
}
update();
m_animation.start();
} else if (m_hasAnimatedImage) {
+ m_animatedImage->setScaledSize(m_pixmap.size());
m_animatedImage->start();
} else {
m_oldPixmap = m_pixmap;
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();
}
if (m_hasAnimatedImage) {
m_animatedImage->stop();
m_hasAnimatedImage = false;
+ delete m_animatedImage;
+ m_animatedImage = nullptr;
}
}