Fix Kirigami.Units.devicePixelRatio=1.3 when it should be 1.0 at 96dpi
AcceptedPublic

Authored by Zren on Tue, May 5, 11:05 PM.

Details

Reviewers
mart
Group Reviewers
Kirigami
Summary

I recently noticed that Kirigami.Units.devicePixelRatio was 1.3 even though I was at the default 96dpi when writing a widget's config.

There's 4 different Units.qml, and I'm not certain which does what. 2 are in krigiami and the other 2 are in plasma-framework.

$ locate /Units.qml | grep /usr/
/usr/lib/qt/qml/org/kde/kirigami.2/Units.qml
/usr/lib/qt/qml/org/kde/kirigami.2/styles/Plasma/Units.qml
/usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop/Units.qml
/usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop.plasma/Units.qml
  • 2 years ago kirigami/src/controls/Units.qml (/usr/lib/qt/qml/org/kde/kirigami.2/Units.qml) was changed from 13/10 = 1.3 to multiply by 13*0.75 so that 9.75/10 = 0.975 (then max(1, 0.975) = 1).

Which means this patch modifies the other file owned by kirigami:

$ pacman -Qo /usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop/Units.qml
/usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop/Units.qml is owned by kirigami2 5.69.0-1

Note that this patch does not fix qmlscene KirigamiDevicePixelRatioTest.qml, nor a plasmashell widget, nor a plasmoidviewer widget. I'm not sure what uses the org.kde.desktop style, as qmlscene uses the org.kde.desktop.plasma it seems. The plasma-framework patch should fix qmlscene.

The plasma-framework patch is D29463

Test Plan

You can edit /usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop/Units.qml to test this patch.


To test the plasma-frameworks patch:

Editing /usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop.plasma/Units.qml then running:

and Kirigami.Units.devicePixelRatio should equal 1.

Diff Detail

Repository
R169 Kirigami
Lint
Lint Skipped
Unit
Unit Tests Skipped
Zren created this revision.Tue, May 5, 11:05 PM
Restricted Application added a project: Kirigami. · View Herald TranscriptTue, May 5, 11:05 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
Zren requested review of this revision.Tue, May 5, 11:05 PM
Zren edited the summary of this revision. (Show Details)Tue, May 5, 11:20 PM
mart added a comment.Mon, May 11, 3:40 PM

the different Units.qml depend from the style, QT_QUICK_CONTROLS_STYLE
all of them, including those in plasma-framework should be updated at once

mart added a comment.Fri, May 15, 12:59 PM
In D29462#668542, @mart wrote:

the different Units.qml depend from the style, QT_QUICK_CONTROLS_STYLE
all of them, including those in plasma-framework should be updated at once

@Zren can you do diffs for the others as well?

Zren added a comment.Fri, May 15, 5:02 PM

The plasma-framework patch is D29463

Ran my KirigamiDevicePixelRatioTest.qml with QT_QUICK_CONTROLS_STYLE=Plasma, /usr/.../styles/org.kde.desktop, /usr/.../styles/org.kde.desktop.plasma, and /usr/.../Kirigami.2.


mart accepted this revision.Tue, May 19, 11:01 AM

looks good

This revision is now accepted and ready to land.Tue, May 19, 11:01 AM