mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
2ef6cd89cc
commit
7ee5b10810
6 changed files with 15 additions and 37 deletions
|
@ -36,8 +36,6 @@
|
|||
#include <QFont>
|
||||
#include <QApplication>
|
||||
#include <QTextDocument>
|
||||
#include <QPainter>
|
||||
#include <QSvgRenderer>
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#ifdef Q_OS_UNIX
|
||||
|
@ -1687,26 +1685,3 @@ extern "C" void emit_reset_signal()
|
|||
{
|
||||
emit diveListNotifier.dataReset();
|
||||
}
|
||||
|
||||
QImage renderSVGIcon(const char *id, int size, bool transparent)
|
||||
{
|
||||
QImage res(size, size, transparent ? QImage::Format_ARGB32 : QImage::Format_RGB32);
|
||||
res.fill(transparent ? Qt::transparent : Qt::white);
|
||||
QSvgRenderer svg{QString(id)};
|
||||
QPainter painter(&res);
|
||||
svg.render(&painter);
|
||||
return res;
|
||||
}
|
||||
|
||||
// As renderSVGIcon(), but render to a fixed width and scale height accordingly
|
||||
// and have a transparent background.
|
||||
QImage renderSVGIconWidth(const char *id, int size)
|
||||
{
|
||||
QSvgRenderer svg{QString(id)};
|
||||
QSize svgSize = svg.defaultSize();
|
||||
QImage res(size, size * svgSize.height() / svgSize.width(), QImage::Format_ARGB32);
|
||||
res.fill(Qt::transparent);
|
||||
QPainter painter(&res);
|
||||
svg.render(&painter);
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue