]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix warning on launch "QPixmap::scaled: Pixmap is a null pixmap"
authorMichael Reeves <reeves.87@gmail.com>
Sun, 3 Aug 2014 08:48:21 +0000 (10:48 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Sun, 3 Aug 2014 08:51:41 +0000 (10:51 +0200)
If Dolphin is launched with the information panel on and set to display
previews, PixmapViewer::paintEvent is called three times before any
pixmap is set. Each time the above warning message is output.

REVIEW: 119553
FIXED-IN: 4.14.0

src/panels/information/pixmapviewer.cpp

index 8a752c587691b27fd5f04dd9cceb7189392766f0..45a8c17e222d1bb64f5d1a185b706c2554e02a24 100644 (file)
@@ -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;