mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 08:52:15 -07:00
fix missing colorless counter
This commit is contained in:
parent
5cfae938a9
commit
2f9bd0f11c
1 changed files with 7 additions and 0 deletions
|
|
@ -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));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue