don't multiply svg sizes by devicepixelratio

Summary:
when the native high dpi scaling is enabled, some things gets scaled two times,
as sizes taken from svgs should *not* be manually scaled by devicePixelRatio

Test Plan:
works correctly on wayland, svg.elementSize will have to be tweaked in x11 to
return a value scaled by scalefactor, to homogenize the behavior compared to
native qt high dpi scaling.
to return a value scaled by scalefactor for this qml code to work there too.
I advise everybody with high dpi laptops to test this on both wayland and x11

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: hein, broulik, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D9286
This commit is contained in:
Marco Martin 2018-01-23 15:58:39 +01:00
parent f3cd5d55fa
commit af00946f81
5 changed files with 7 additions and 7 deletions

View File

@ -28,8 +28,8 @@ PlasmaCore.FrameSvgItem {
imagePath:"widgets/scrollbar"
prefix: internalLoader.isVertical ? "background-vertical" : "background-horizontal"
property int implicitWidth: (scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").width : scrollbarSvg.elementSize("arrow-up").width) * Math.max(1, Math.floor(units.devicePixelRatio))
property int implicitHeight: (scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").height : scrollbarSvg.elementSize("arrow-left").height) * Math.max(1, Math.floor(units.devicePixelRatio))
property int implicitWidth: (scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").width : scrollbarSvg.elementSize("arrow-up").width)
property int implicitHeight: (scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").height : scrollbarSvg.elementSize("arrow-left").height)
Keys.onUpPressed: {
if (!enabled || !internalLoader.isVertical)

View File

@ -28,8 +28,8 @@ PlasmaCore.FrameSvgItem {
imagePath:"widgets/scrollbar"
prefix: internalLoader.isVertical ? "background-vertical" : "background-horizontal"
property int implicitWidth: scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").width * Math.max(1, Math.floor(units.devicePixelRatio)) : 12
property int implicitHeight: scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").height * Math.max(1, Math.floor(units.devicePixelRatio)) : 12
property int implicitWidth: scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").width : 12
property int implicitHeight: scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").height : 12
opacity: 0
Behavior on opacity {

View File

@ -29,7 +29,7 @@ ProgressBarStyle {
readonly property string imagePath: "widgets/bar_meter_horizontal"
readonly property real implicitHeight: barSvg.preferredHeight * Math.max(1, Math.floor(units.devicePixelRatio))
readonly property real implicitHeight: barSvg.preferredHeight
PlasmaCore.Svg {
id: barSvg

View File

@ -28,7 +28,7 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
QtQuickControlStyle.ScrollViewStyle {
property Flickable flickableItem: control.flickableItem
property real widthHint: Math.round( (scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").width : scrollbarSvg.elementSize("arrow-up").width) * units.devicePixelRatio)
property real widthHint: Math.round( (scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").width : scrollbarSvg.elementSize("arrow-up").width))
property StyleItem __styleitem: StyleItem { elementType: "frame" }
readonly property int __wheelScrollLines: __styleitem.styleHint("wheelScrollLines")

View File

@ -34,7 +34,7 @@ QtQuickControlStyle.TableViewStyle {
activateItemOnSingleClick: false
property real scrollbarWidthHint: Math.round( (scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").width : scrollbarSvg.elementSize("arrow-up").width) * units.devicePixelRatio)
property real scrollbarWidthHint: Math.round( (scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").width : scrollbarSvg.elementSize("arrow-up").width))
headerDelegate: PlasmaCore.FrameSvgItem {
imagePath: "widgets/button"