forked from qt-creator/qt-creator
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user