<table><tr><td style="">hein added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D9119" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>So I worked out why this happens. We have API like this:</p>

<p>SvgItem {</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">svg: Svg { imagePath: "..." }</pre></div>

<p>}</p>

<p>Without my patch, <tt style="background: #ebebeb; font-size: 13px;">Svg</tt> is instanciated with a scale factor of 1.0 always. Then <tt style="background: #ebebeb; font-size: 13px;">setImagePath</tt> is called on it first. Then <tt style="background: #ebebeb; font-size: 13px;">SvgItem::setSvg</tt> is called with the <tt style="background: #ebebeb; font-size: 13px;">Svg</tt> instance and calls <tt style="background: #ebebeb; font-size: 13px;">setScaleFactor</tt> on it.</p>

<p>In this pattern, <tt style="background: #ebebeb; font-size: 13px;">SvgItem</tt> doesn't get a chance to set the scale factor before <tt style="background: #ebebeb; font-size: 13px;">imagePath</tt>, because it's not the one setting the latter.</p>

<p>The only call site fix here would be to implement <tt style="background: #ebebeb; font-size: 13px;">QQmlParserStatus</tt> in <tt style="background: #ebebeb; font-size: 13px;">Svg</tt> and then set <tt style="background: #ebebeb; font-size: 13px;">scaleFactor</tt> from QML everywhere by accessing <tt style="background: #ebebeb; font-size: 13px;">Units</tt>. But this hygiene would be really hard to enforce, especially in third-party widgets.</p>

<p>I still consider my patch to be a fairly pragmatic solution to this.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R242 Plasma Framework (Library)</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D9119" rel="noreferrer">https://phabricator.kde.org/D9119</a></div></div><br /><div><strong>To: </strong>hein, Plasma, davidedmundson, broulik, mart<br /><strong>Cc: </strong>graesslin, plasma-devel, Frameworks, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>