m_animation.setCurveShape(QTimeLine::LinearCurve);
if (m_transition != NoTransition) {
- connect(&m_animation, SIGNAL(valueChanged(qreal)), this, SLOT(update()));
- connect(&m_animation, SIGNAL(finished()), this, SLOT(checkPendingPixmaps()));
+ connect(&m_animation, &QTimeLine::valueChanged, this, static_cast<void(PixmapViewer::*)()>(&PixmapViewer::update));
+ connect(&m_animation, &QTimeLine::finished, this, &PixmapViewer::checkPendingPixmaps);
}
}
const bool useOldPixmap = (m_transition == SizeTransition) &&
(m_oldPixmap.width() > m_pixmap.width());
const QPixmap& largePixmap = useOldPixmap ? m_oldPixmap : m_pixmap;
- const QPixmap scaledPixmap = largePixmap.scaled(scaledWidth,
- scaledHeight,
- Qt::IgnoreAspectRatio,
- Qt::FastTransformation);
- painter.drawPixmap(x, y, scaledPixmap);
+ if (!largePixmap.isNull()) {
+ const QPixmap scaledPixmap = largePixmap.scaled(scaledWidth,
+ scaledHeight,
+ Qt::IgnoreAspectRatio,
+ Qt::FastTransformation);
+ painter.drawPixmap(x, y, scaledPixmap);
+ }
} else {
const int x = (width() - m_pixmap.width() ) / 2;
const int y = (height() - m_pixmap.height()) / 2;
}
}
-#include "pixmapviewer.moc"