Examples: Avoid warning about scaling null image

Change-Id: I16f75c2c6d05017b99596ca0855e0d86f4a74a6f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Eike Ziller
2023-10-19 15:32:04 +02:00
parent 3581d1c5dd
commit 7c64f1d4dc

View File

@@ -251,8 +251,11 @@ static QPixmap fetchPixmapAndUpdatePixmapCache(const QString &url)
// boundedTo -> don't scale thumbnails up
const QSize scaledSize =
WelcomePageHelpers::GridItemImageSize.boundedTo(img.size()) * dpr;
pixmap = QPixmap::fromImage(
img.scaled(scaledSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));
const QImage scaled = img.isNull() ? img
: img.scaled(scaledSize,
Qt::KeepAspectRatio,
Qt::SmoothTransformation);
pixmap = QPixmap::fromImage(scaled);
pixmap.setDevicePixelRatio(dpr);
}
} else {