forked from qt-creator/qt-creator
QtSupport: Remove screenshot cropper
Reduce maintenance by removing a feature that broke in 7.0, caused assertions. The absence of the cropper won't most likely be noticed, because the examples thumbnail size was increased quite a bit in the last Welcome Screen redesign. Instead of cropping, we now always scale the thumbnail to ListModel::defaultImageSize. As a benefit of this simplification, the thumbnail is now also High-DPI enabled. Fixes: QTCREATORBUG-27141 Change-Id: I57cafb000c3095dd387cd96814b6e946980b2aed Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -24,9 +24,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "exampleslistmodel.h"
|
||||
#include "screenshotcropper.h"
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QImageReader>
|
||||
@@ -527,8 +527,13 @@ QPixmap ExamplesListModel::fetchPixmapAndUpdatePixmapCache(const QString &url) c
|
||||
imgBuffer.open(QIODevice::ReadOnly);
|
||||
QImageReader reader(&imgBuffer, QFileInfo(url).suffix().toLatin1());
|
||||
QImage img = reader.read();
|
||||
img = ScreenshotCropper::croppedImage(img, url, ListModel::defaultImageSize);
|
||||
pixmap = QPixmap::fromImage(img);
|
||||
img.convertTo(QImage::Format_RGB32);
|
||||
const int dpr = qApp->devicePixelRatio();
|
||||
// boundedTo -> don't scale thumbnails up
|
||||
const QSize scaledSize = ListModel::defaultImageSize.boundedTo(img.size()) * dpr;
|
||||
pixmap = QPixmap::fromImage(
|
||||
img.scaled(scaledSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
pixmap.setDevicePixelRatio(dpr);
|
||||
}
|
||||
}
|
||||
QPixmapCache::insert(url, pixmap);
|
||||
|
||||
Reference in New Issue
Block a user