Commit 8f9e537d authored by Tim Jenssen's avatar Tim Jenssen

Icons: warn about invalid resources

Also give a 1x1 pixmap back to avoid paint engine error messages.

Change-Id: Ibd7793d133952c4c3169796432b42572af0ace21
Reviewed-by: Alessandro Portale's avatarAlessandro Portale <alessandro.portale@qt.io>
parent b29ea452
......@@ -36,6 +36,7 @@
#include <QPainter>
#include <QPaintEngine>
#include <QWidget>
#include <QDebug>
namespace Utils {
......@@ -67,7 +68,12 @@ static MasksAndColors masksAndColors(const Icon &icon, int dpr)
const QColor color = creatorTheme()->color(i.second);
const QString dprFileName = StyleHelper::availableImageResolutions(i.first).contains(dpr) ?
StyleHelper::imageFileWithResolution(fileName, dpr) : fileName;
result.append(qMakePair(QPixmap(dprFileName), color));
QPixmap pixmap;
if (!pixmap.load(dprFileName)) {
pixmap = QPixmap(1, 1);
qWarning() << "Could not load image: " << dprFileName;
}
result.append({pixmap, color});
}
return result;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment