fix missing colorless counter

This commit is contained in:
RickyRister 2025-02-02 18:33:53 -08:00
parent 5cfae938a9
commit 2f9bd0f11c

View file

@ -14,6 +14,8 @@
* *
* @param svgPath The path to the svg file. Automatically appends ".svg" to the end if not present * @param svgPath The path to the svg file. Automatically appends ".svg" to the end if not present
* @param size The desired size of the pixmap * @param size The desired size of the pixmap
*
* @return The svg loaded into a Pixmap with the given size, or an empty Pixmap if the loading failed.
*/ */
static QPixmap loadSvg(const QString &svgPath, const QSize &size) static QPixmap loadSvg(const QString &svgPath, const QSize &size)
{ {
@ -24,6 +26,11 @@ static QPixmap loadSvg(const QString &svgPath, const QSize &size)
QSvgRenderer svgRenderer(path); QSvgRenderer svgRenderer(path);
if (!svgRenderer.isValid()) {
qCWarning(PixelMapGeneratorLog) << "Failed to load" << path;
return {};
}
// Makes sure the pixmap is at least as large as the svg, so that we don't lose any detail. // Makes sure the pixmap is at least as large as the svg, so that we don't lose any detail.
// QIcon.pixmap(size) will automatically scale down the image, but it won't scale it up. // QIcon.pixmap(size) will automatically scale down the image, but it won't scale it up.
QPixmap pix(svgRenderer.defaultSize().expandedTo(size)); QPixmap pix(svgRenderer.defaultSize().expandedTo(size));