]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/information/pixmapviewer.cpp
Merge branch 'master' into frameworks
[dolphin.git] / src / panels / information / pixmapviewer.cpp
index 8a752c587691b27fd5f04dd9cceb7189392766f0..7b3a212f2e64f76c170a2251fd52e9e1cda31c6e 100644 (file)
@@ -39,8 +39,8 @@ PixmapViewer::PixmapViewer(QWidget* parent, Transition transition) :
     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);
     }
 }
 
@@ -102,11 +102,13 @@ void PixmapViewer::paintEvent(QPaintEvent* event)
         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;
@@ -127,4 +129,3 @@ void PixmapViewer::checkPendingPixmaps()
     }
 }
 
-#include "pixmapviewer.moc"