<table><tr><td style="">Zren created this revision.<br />Herald added a project: Kirigami.<br />Herald added a subscriber: plasma-devel.<br />Zren requested review of this revision.
</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/D29462">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>I recently noticed that <tt style="background: #ebebeb; font-size: 13px;">Kirigami.Units.devicePixelRatio</tt> was <tt style="background: #ebebeb; font-size: 13px;">1.3</tt> even though I was at the default 96dpi when writing a widget's config.</p>

<p><a href="https://phabricator.kde.org/F8287886" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">F8287886: 2020-05-05___19-00-48.png</a></p>

<p>There's 4 different <tt style="background: #ebebeb; font-size: 13px;">Units.qml</tt>, and I'm not certain which does what. 2 are in <tt style="background: #ebebeb; font-size: 13px;">krigiami</tt> and the other 2 are in <tt style="background: #ebebeb; font-size: 13px;">plasma-framework</tt>.</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="console" 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);"><span style="color: #000080">$ locate /Units.qml | grep /usr/</span>
<span style="color: #808080">/usr/lib/qt/qml/org/kde/kirigami.2/Units.qml</span>
<span style="color: #808080">/usr/lib/qt/qml/org/kde/kirigami.2/styles/Plasma/Units.qml</span>
<span style="color: #808080">/usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop/Units.qml</span>
<span style="color: #808080">/usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop.plasma/Units.qml</span></pre></div>



<ul class="remarkup-list">
<li class="remarkup-list-item">2 years ago <a href="https://github.com/KDE/kirigami/blame/master/src/controls/Units.qml#L75" class="remarkup-link" target="_blank" rel="noreferrer"><tt style="background: #ebebeb; font-size: 13px;">kirigami/src/controls/Units.qml</tt></a> (<tt style="background: #ebebeb; font-size: 13px;">/usr/lib/qt/qml/org/kde/kirigami.2/Units.qml</tt>) was changed from <tt style="background: #ebebeb; font-size: 13px;">13/10 = 1.3</tt> to multiply by <tt style="background: #ebebeb; font-size: 13px;">13*0.75</tt> so that <tt style="background: #ebebeb; font-size: 13px;">9.75/10 = 0.975</tt> (then <tt style="background: #ebebeb; font-size: 13px;">max(1, 0.975) = 1</tt>).</li>
</ul>

<hr class="remarkup-hr" />

<p>Which means this patch modifies the other file owned by <tt style="background: #ebebeb; font-size: 13px;">kirigami</tt>:</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="console" 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);"><span style="color: #000080">$ pacman -Qo /usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop/Units.qml</span>
<span style="color: #808080">/usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop/Units.qml is owned by kirigami2 5.69.0-1</span></pre></div>

<p>Note that this patch <strong>does not fix</strong> <tt style="background: #ebebeb; font-size: 13px;">qmlscene KirigamiDevicePixelRatioTest.qml</tt>, nor a <tt style="background: #ebebeb; font-size: 13px;">plasmashell</tt> widget, nor a <tt style="background: #ebebeb; font-size: 13px;">plasmoidviewer</tt> widget. I'm not sure what uses the <tt style="background: #ebebeb; font-size: 13px;">org.kde.desktop</tt> style, as <tt style="background: #ebebeb; font-size: 13px;">qmlscene</tt> uses the <tt style="background: #ebebeb; font-size: 13px;">org.kde.desktop.plasma</tt> it seems. The <tt style="background: #ebebeb; font-size: 13px;">plasma-framework</tt> patch should fix <tt style="background: #ebebeb; font-size: 13px;">qmlscene</tt>.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>You can edit <tt style="background: #ebebeb; font-size: 13px;">/usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop/Units.qml</tt> to test this patch.</p>

<hr class="remarkup-hr" />

<p>To test the <tt style="background: #ebebeb; font-size: 13px;">plasma-frameworks</tt> patch:</p>

<p>Editing <tt style="background: #ebebeb; font-size: 13px;">/usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop.plasma/Units.qml</tt> then running:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item"><a href="https://gist.github.com/Zren/621338b8cda7c550d7b43f8ea1ba71a7" class="remarkup-link" target="_blank" rel="noreferrer">https://gist.github.com/Zren/621338b8cda7c550d7b43f8ea1ba71a7</a></li>
<li class="remarkup-list-item"><tt style="background: #ebebeb; font-size: 13px;">qmlscene KirigamiDevicePixelRatioTest.qml</tt></li>
</ul>

<p>and <tt style="background: #ebebeb; font-size: 13px;">Kirigami.Units.devicePixelRatio</tt> should equal <tt style="background: #ebebeb; font-size: 13px;">1</tt>.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R169 Kirigami</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D29462">https://phabricator.kde.org/D29462</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/controls/Units.qml<br />
src/styles/org.kde.desktop/Units.qml</div></div></div><br /><div><strong>To: </strong>Zren<br /><strong>Cc: </strong>plasma-devel, fbampaloukas, GB_2, domson, dkardarakos, ngraham, apol, ahiemstra, davidedmundson, mart<br /></div>