Desktop: Remove 'renderSVGIcon' methods.

Remove `renderSVGIcon()` and `renderSVGIconWidth()`, as QPixmaps can be
loaded directly from SVG, and support scaling.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2023-05-29 00:21:52 +12:00 committed by Dirk Hohndel
parent 2ef6cd89cc
commit 7ee5b10810
6 changed files with 15 additions and 37 deletions

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "chartlistmodel.h"
#include "core/metrics.h"
#include "core/qthelper.h"
#include <QIcon>
#include <QFontMetrics>
#include <QPainter>
@ -14,7 +13,7 @@ ChartListModel::ChartListModel() :
int fontHeight = fm.height();
int iconSize = fontHeight * 2;
warningPixmap = QPixmap::fromImage(renderSVGIcon(":chart-warning-icon", fontHeight, true));
warningPixmap = QPixmap(":chart-warning-icon").scaled(fontHeight, fontHeight, Qt::KeepAspectRatio);
initIcon(ChartSubType::Vertical, ":chart-bar-vertical-icon", iconSize);
initIcon(ChartSubType::VerticalGrouped, ":chart-bar-grouped-vertical-icon", iconSize);
initIcon(ChartSubType::VerticalStacked, ":chart-bar-stacked-vertical-icon", iconSize);
@ -32,7 +31,7 @@ ChartListModel::~ChartListModel()
void ChartListModel::initIcon(ChartSubType type, const char *name, int iconSize)
{
QPixmap icon = QPixmap::fromImage(renderSVGIcon(name, iconSize, true));
QPixmap icon = QPixmap(name).scaled(iconSize, iconSize, Qt::KeepAspectRatio);
QPixmap iconWarning = icon.copy();
QPainter painter(&iconWarning);
painter.drawPixmap(0, 0, warningPixmap);