From c7cc40c464cd7cf8bfe514c421978e449b555975 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 6 Jun 2024 17:43:21 +0800 Subject: [PATCH] Correctly fall back to originalSize if requestedSize not valid in svg image provider Signed-off-by: Claudio Cambra --- src/gui/iconutils.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/iconutils.cpp b/src/gui/iconutils.cpp index c25adbc76..ba9204e03 100644 --- a/src/gui/iconutils.cpp +++ b/src/gui/iconutils.cpp @@ -108,9 +108,11 @@ QImage createSvgImageWithCustomColor(const QString &fileName, return {}; } + const auto sizeToUse = requestedSize.isValid() ? requestedSize : *originalSize; + // some icons are present in white or black only, so, we need to check both when needed const auto iconBaseColors = QStringList{QStringLiteral("black"), QStringLiteral("white")}; - const auto customColorImage = findImageWithCustomColor(fileName, customColor, iconBaseColors, requestedSize); + const auto customColorImage = findImageWithCustomColor(fileName, customColor, iconBaseColors, sizeToUse); if (!customColorImage.isNull()) { return customColorImage; @@ -125,7 +127,7 @@ QImage createSvgImageWithCustomColor(const QString &fileName, return {}; } - const auto result = drawSvgWithCustomFillColor(sourceSvg, customColor, originalSize, requestedSize); + const auto result = drawSvgWithCustomFillColor(sourceSvg, customColor, originalSize, sizeToUse); Q_ASSERT(!result.isNull()); if (result.isNull()) { -- 2.30.2