diff options
| author | Michael Reeves <[email protected]> | 2014-08-03 10:48:21 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2014-08-03 10:51:41 +0200 |
| commit | a31b836479a1df2138fb4cc295db2f2a4fb97ed8 (patch) | |
| tree | 0d2b9a99fdd0741e13d477c54dccc7f84adf30b0 /src | |
| parent | 3d076f7c5e77312e3e0a2878eec81116cd22761c (diff) | |
Fix warning on launch "QPixmap::scaled: Pixmap is a null pixmap"
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/panels/information/pixmapviewer.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/panels/information/pixmapviewer.cpp b/src/panels/information/pixmapviewer.cpp index 8a752c587..45a8c17e2 100644 --- a/src/panels/information/pixmapviewer.cpp +++ b/src/panels/information/pixmapviewer.cpp @@ -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; |
