From da446d0d1578cd7e3041fe9e3c9bf5fbb23782d7 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 20 Jul 2022 12:25:37 +0200 Subject: [PATCH] MarketPlace: Use HighDpi resolution for thumbnails Let's create the thumbnail in the highest possible resolution for better visual quality. Change-Id: I35f67829ed6232cd3a139161e5695661b3adf271 Reviewed-by: Reviewed-by: Christian Stenger Reviewed-by: Eike Ziller --- src/plugins/marketplace/productlistmodel.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/marketplace/productlistmodel.cpp b/src/plugins/marketplace/productlistmodel.cpp index 511ee65836c..9ea421395d6 100644 --- a/src/plugins/marketplace/productlistmodel.cpp +++ b/src/plugins/marketplace/productlistmodel.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -353,8 +354,11 @@ void SectionedProducts::onImageDownloadFinished(QNetworkReply *reply) const QString imageFormat = QFileInfo(imageUrl.fileName()).suffix(); if (pixmap.loadFromData(data, imageFormat.toLatin1())) { const QString url = imageUrl.toString(); - QPixmapCache::insert(url, pixmap.scaled(ProductListModel::defaultImageSize, - Qt::KeepAspectRatio, Qt::SmoothTransformation)); + const int dpr = qApp->devicePixelRatio(); + pixmap = pixmap.scaled(ProductListModel::defaultImageSize * dpr, + Qt::KeepAspectRatio, Qt::SmoothTransformation); + pixmap.setDevicePixelRatio(dpr); + QPixmapCache::insert(url, pixmap); for (ProductListModel *model : qAsConst(m_productModels)) model->updateModelIndexesForUrl(url); }