diff options
author | Eike Ziller <eike.ziller@qt.io> | 2023-10-19 15:32:04 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2023-10-31 07:23:44 +0000 |
commit | 7c64f1d4dce6ac0fd1d26a97ea63413cacb6570a (patch) | |
tree | 44b08fb485d987bbae6717549bf1685741a06591 /src/plugins/qtsupport/exampleslistmodel.cpp | |
parent | 3581d1c5dd624c7d6f3cf06be9353c1d22213a79 (diff) |
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>
Diffstat (limited to 'src/plugins/qtsupport/exampleslistmodel.cpp')
-rw-r--r-- | src/plugins/qtsupport/exampleslistmodel.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index 83d1659a5f..2a48449ef3 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -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 { |