From e2c1f4ebe4a1f520cdbe24844d2fef750b85b8ec Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 21 Dec 2023 18:50:30 +0100 Subject: [PATCH] Fix rendering issues with Syncthing icon with Qt 6.7.0beta1 It looks like Qt Svg supports masking as of 6.7 which revealed a bug in the code for making Syncthing icons. The mask for the emblem area was also accidentally applied in case no emblem is shown. This change adds the mask only when an emblem is shown. --- syncthingmodel/syncthingicons.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/syncthingmodel/syncthingicons.cpp b/syncthingmodel/syncthingicons.cpp index 3f27cde..b2aab59 100644 --- a/syncthingmodel/syncthingicons.cpp +++ b/syncthingmodel/syncthingicons.cpp @@ -93,9 +93,20 @@ QByteArray makeSyncthingIcon(const StatusIconColorSet &colors, StatusEmblem stat "" ), }; + static const auto emblemAreaMaskAttribute = QStringLiteral(" mask=\"url(#bitemask)\""); + static const auto emblemAreaMask = QStringLiteral( + "" + "" + "" + "" + "" + "" + ); static const auto normalStrokeWidth = QStringLiteral("0.81771719"), thickStrokeWidth = QStringLiteral("1.22"); static const auto normalCircleRadius = QStringLiteral("1.22"), largeCircleRadius = QStringLiteral("1.5"); const auto &emblemData = emblems[static_cast(statusEmblem)]; + const auto &emblemAreaMaskAttributeData = statusEmblem != StatusEmblem::None ? emblemAreaMaskAttribute : emblems[0]; + const auto &emblemAreaMaskData = statusEmblem != StatusEmblem::None ? emblemAreaMask : emblems[0]; const auto &strokeWidthF = strokeWidth == StatusIconStrokeWidth::Normal ? normalStrokeWidth : thickStrokeWidth; const auto &circleRadius = strokeWidth == StatusIconStrokeWidth::Normal ? normalCircleRadius : largeCircleRadius; return (QStringLiteral( @@ -105,15 +116,9 @@ QByteArray makeSyncthingIcon(const StatusIconColorSet &colors, StatusEmblem stat "" "" "" - "" - "" - "" - "" - "" - "" - "" + "") % emblemAreaMaskData % QStringLiteral( "" - "" + "" "" "" ""