Compare commits

..

No commits in common. "e4cca91b12dd9419485c19bece76534972324f6a" and "c0c2733a9e5e924fa7c19bfd84cbe900c173ab76" have entirely different histories.

2 changed files with 26 additions and 11 deletions

View file

@ -39,8 +39,6 @@ Item {
Accessible.role: Accessible.Canvas Accessible.role: Accessible.Canvas
readonly property real dpi: main.Window.window.devicePixelRatio
// This MouseArea exists to intercept press and hold; preventing edit mode // This MouseArea exists to intercept press and hold; preventing edit mode
// from being triggered when pressing and holding on an icon (if there is one). // from being triggered when pressing and holding on an icon (if there is one).
MouseArea { MouseArea {
@ -207,7 +205,7 @@ Item {
active: impl.iconAndLabelsShouldlookSelected || model.selected active: impl.iconAndLabelsShouldlookSelected || model.selected
asynchronous: true asynchronous: true
width: Math.round(parent.width * main.dpi) / main.dpi width: parent.width
height: root.useListViewMode height: root.useListViewMode
? parent.height ? parent.height
@ -311,10 +309,22 @@ Item {
PlasmaComponents.Label { PlasmaComponents.Label {
id: label id: label
z: 2 // So it's always above the highlight effect renderType: Text.NativeRendering
renderType: main.dpi == 1.0 ? Text.NativeRendering : Text.QtRendering
font.hintingPreference: Font.PreferFullHinting font.hintingPreference: Font.PreferFullHinting
z: 2 // So it's always above the highlight effect
font.kerning: Screen.devicePixelRatio == 1.0
Timer {
id: hidpi_hack
interval: 50
onTriggered: {
front.anchors.rightMargin += 1;
front.anchors.rightMargin -= 1;
behind.anchors.rightMargin += 1;
behind.anchors.rightMargin -= 1;
}
}
// Hacks to improve font rendering to increase contrast and text brightness // Hacks to improve font rendering to increase contrast and text brightness
// This is done to get darker subpixel rendering, closer to ClearType // This is done to get darker subpixel rendering, closer to ClearType
PlasmaComponents.Label { PlasmaComponents.Label {
@ -324,8 +334,9 @@ Item {
anchors.rightMargin: 1 anchors.rightMargin: 1
anchors.leftMargin: -1 anchors.leftMargin: -1
color: model.selected && Plasmoid.configuration.selectionStyle ? "black" : "#F9000000" color: model.selected && Plasmoid.configuration.selectionStyle ? "black" : "#F9000000"
renderType: main.dpi == 1.0 ? Text.NativeRendering : Text.QtRendering renderType: Text.NativeRendering
font.hintingPreference: Font.PreferFullHinting font.hintingPreference: Font.PreferFullHinting
font.kerning: Screen.devicePixelRatio == 1.0
text: parent.text text: parent.text
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: parent.maximumLineCount maximumLineCount: parent.maximumLineCount
@ -339,8 +350,9 @@ Item {
anchors.fill: parent anchors.fill: parent
anchors.rightMargin: 0 anchors.rightMargin: 0
color: model.selected && Plasmoid.configuration.selectionStyle ? "black" : "#ffffffff" color: model.selected && Plasmoid.configuration.selectionStyle ? "black" : "#ffffffff"
renderType: main.dpi == 1.0 ? Text.NativeRendering : Text.QtRendering renderType: Text.NativeRendering
font.hintingPreference: Font.PreferFullHinting font.hintingPreference: Font.PreferFullHinting
font.kerning: Screen.devicePixelRatio == 1.0
text: parent.text text: parent.text
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: parent.maximumLineCount maximumLineCount: parent.maximumLineCount
@ -357,7 +369,7 @@ Item {
target: label target: label
anchors.topMargin: Kirigami.Units.smallSpacing anchors.topMargin: Kirigami.Units.smallSpacing
// Ffs // Ffs
width: Math.round((parent.width - Kirigami.Units.smallSpacing) * main.dpi) / main.dpi width: Math.floor((parent.width - Kirigami.Units.smallSpacing + (Screen.devicePixelRatio != 1.0) * 2 * Screen.devicePixelRatio) * Screen.devicePixelRatio) / Screen.devicePixelRatio
maximumLineCount: Plasmoid.configuration.textLines maximumLineCount: Plasmoid.configuration.textLines
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
@ -385,6 +397,11 @@ Item {
anchors.rightMargin: 1 anchors.rightMargin: 1
anchors.leftMargin: -1 anchors.leftMargin: -1
} }
StateChangeScript {
script: {
hidpi_hack.start();
}
}
}, },
State { // list view State { // list view
when: root.useListViewMode when: root.useListViewMode

View file

@ -32,8 +32,6 @@ Item {
} }
} }
property real dpi: root.Window.window.devicePixelRatio
property Item containment property Item containment
property bool floatingPrefix: floatingPanelSvg.usedPrefix === "floating" property bool floatingPrefix: floatingPanelSvg.usedPrefix === "floating"
readonly property bool verticalPanel: containment?.plasmoid?.formFactor === PlasmaCore.Types.Vertical readonly property bool verticalPanel: containment?.plasmoid?.formFactor === PlasmaCore.Types.Vertical
@ -153,7 +151,7 @@ Item {
property var panelMask: floatingness === 0 ? (panelOpacity === 1 ? opaqueItem.mask : translucentItem.mask) : (panelOpacity === 1 ? floatingOpaqueItem.mask : floatingTranslucentItem.mask) property var panelMask: floatingness === 0 ? (panelOpacity === 1 ? opaqueItem.mask : translucentItem.mask) : (panelOpacity === 1 ? floatingOpaqueItem.mask : floatingTranslucentItem.mask)
// The point is read from panelview.cpp and is used as an offset for the mask // The point is read from panelview.cpp and is used as an offset for the mask
readonly property point floatingTranslucentItemOffset: Qt.point(floatingTranslucentItem.x+(root.rightEdge && root.dpi != 1.0 ? 1 : 0), floatingTranslucentItem.y+(root.bottomEdge && root.dpi != 1.0 ? 1 : 0)) readonly property point floatingTranslucentItemOffset: Qt.point(floatingTranslucentItem.x, floatingTranslucentItem.y)
KSvg.FrameSvgItem { KSvg.FrameSvgItem {
id: translucentItem id: translucentItem