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

Authored by Zren on Jun 9 2020, 2:46 PM.

Description

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

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.

Reviewers: Kirigami, mart

Reviewed By: Kirigami, mart

Subscribers: davidre, plasma-devel

Tags: Kirigami

Differential Revision: https://phabricator.kde.org/D29462

Details