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. {F8287886} 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`](https://github.com/KDE/kirigami/blame/master/src/controls/Units.qml#L75) (`/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`). ----- There's 2 files owned by `plasma-framework`. The `/styles/Plasma/Units.qml` binds PlasmaCore's `units.devicePixelRatio`, so that leaves `/styles/org.kde.desktop.plasma/Units.qml`. ``` $ pacman -Qo /usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop.plasma/Units.qml /usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop.plasma/Units.qml is owned by plasma-framework 5.69.0-2 ``` This patch edits the `org.kde.desktop.plasma` style, and fixes `qmlscene KirigamiDevicePixelRatioTest.qml`, and `plasmashell` widget configs, and `plasmoidviewer` widget configs. The Kirigami patch is D29462 Test Plan: You can edit `/usr/lib/qt/qml/org/kde/kirigami.2/styles/org.kde.desktop.plasma/Units.qml` then run: * https://gist.github.com/Zren/621338b8cda7c550d7b43f8ea1ba71a7 * `qmlscene KirigamiDevicePixelRatioTest.qml` and `Kirigami.Units.devicePixelRatio` should equal `1`. Reviewers: #kirigami, mart Reviewed By: #kirigami, mart Subscribers: davidre, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D29463
This commit is contained in:
parent
7f9e189d87
commit
7005ef0ec8
@ -27,6 +27,10 @@ import org.kde.kirigami 2.4
|
||||
pragma Singleton
|
||||
|
||||
|
||||
/**
|
||||
* A set of values to define semantically sizes and durations
|
||||
* @inherit QtQuick.QtObject
|
||||
*/
|
||||
QtObject {
|
||||
id: unitsRoot
|
||||
|
||||
@ -85,7 +89,7 @@ QtObject {
|
||||
* use theme.mSize(theme.defaultFont), units.smallSpacing and units.largeSpacing.
|
||||
* The devicePixelRatio follows the definition of "device independent pixel" by Microsoft.
|
||||
*/
|
||||
property real devicePixelRatio: Math.max(1, (fontMetrics.font.pixelSize / fontMetrics.font.pointSize))
|
||||
property real devicePixelRatio: Math.max(1, ((fontMetrics.font.pixelSize*0.75) / fontMetrics.font.pointSize))
|
||||
|
||||
/**
|
||||
* units.longDuration should be used for longer, screen-covering animations, for opening and
|
||||
@ -113,8 +117,16 @@ QtObject {
|
||||
*/
|
||||
readonly property int wheelScrollLines: __styleItem.styleHint("wheelScrollLines")
|
||||
|
||||
/**
|
||||
* time in ms by which the display of tooltips will be delayed.
|
||||
*
|
||||
* @sa ToolTip.delay property
|
||||
*/
|
||||
property int toolTipDelay: 700
|
||||
|
||||
/**
|
||||
* metrics used by the default font
|
||||
*/
|
||||
property variant fontMetrics: TextMetrics {
|
||||
text: "M"
|
||||
function roundedIconSize(size) {
|
||||
|
@ -23,6 +23,10 @@ import QtQuick 2.4
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.kirigami 2.4
|
||||
|
||||
/**
|
||||
* A set of values to define semantically sizes and durations
|
||||
* @inherit QtQuick.QtObject
|
||||
*/
|
||||
QtObject {
|
||||
/**
|
||||
* The fundamental unit of space that should be used for sizes, expressed in pixels.
|
||||
@ -105,6 +109,11 @@ QtObject {
|
||||
*/
|
||||
property int wheelScrollLines: 3
|
||||
|
||||
/**
|
||||
* time in ms by which the display of tooltips will be delayed.
|
||||
*
|
||||
* @sa ToolTip.delay property
|
||||
*/
|
||||
property int toolTipDelay: Settings.tabletMode ? Qt.styleHints.mousePressAndHoldInterval : 700
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user