diff --git a/src/declarativeimports/plasmacomponents/qml/private/ScrollBarDelegate.qml b/src/declarativeimports/plasmacomponents/qml/private/ScrollBarDelegate.qml index db9f28f00..ea5ef4941 100644 --- a/src/declarativeimports/plasmacomponents/qml/private/ScrollBarDelegate.qml +++ b/src/declarativeimports/plasmacomponents/qml/private/ScrollBarDelegate.qml @@ -1,267 +1,267 @@ /* * Copyright (C) 2011 by Daker Fernandes Pinheiro * Copyright (C) 2011 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ import QtQuick 2.1 import org.kde.plasma.core 2.0 as PlasmaCore PlasmaCore.FrameSvgItem { id: background anchors.fill: parent 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) return; if (inverted) internalLoader.incrementValue(stepSize); else internalLoader.incrementValue(-stepSize); } Keys.onDownPressed: { if (!enabled || !internalLoader.isVertical) return; if (inverted) internalLoader.incrementValue(-stepSize); else internalLoader.incrementValue(stepSize); } Keys.onLeftPressed: { if (!enabled || internalLoader.isVertical) return; if (inverted) internalLoader.incrementValue(stepSize); else internalLoader.incrementValue(-stepSize); } Keys.onRightPressed: { if (!enabled || internalLoader.isVertical) return; if (inverted) internalLoader.incrementValue(-stepSize); else internalLoader.incrementValue(stepSize); } property Item handle: handle property Item contents: contents Item { id: contents anchors { fill: parent leftMargin: (!internalLoader.isVertical && leftButton.visible) ? leftButton.width : 0 rightMargin: (!internalLoader.isVertical && rightButton.visible) ? rightButton.width : 0 topMargin: (internalLoader.isVertical && leftButton.visible) ? leftButton.height : 0 bottomMargin: (internalLoader.isVertical && rightButton.visible) ? rightButton.height : 0 } PlasmaCore.FrameSvgItem { id: handle imagePath:"widgets/scrollbar" prefix: { if (mouseArea.pressed) { return "sunken-slider" } if (scrollbar.activeFocus || mouseArea.containsMouse) { return "mouseover-slider" } else { return "slider" } } property int length: internalLoader.isVertical? flickableItem.visibleArea.heightRatio * parent.height : flickableItem.visibleArea.widthRatio * parent.width width: internalLoader.isVertical ? parent.width : length height: internalLoader.isVertical ? length : parent.height } } PlasmaCore.Svg { id: scrollbarSvg imagePath: "widgets/scrollbar" property bool arrowPresent: scrollbarSvg.hasElement("arrow-up") //new theme may be different onRepaintNeeded: arrowPresent = scrollbarSvg.hasElement("arrow-up") } PlasmaCore.SvgItem { id: leftButton visible: stepSize > 0 && scrollbarSvg.arrowPresent anchors { left: internalLoader.isVertical ? undefined : parent.left verticalCenter: internalLoader.isVertical ? undefined : parent.verticalCenter top: internalLoader.isVertical ? parent.top : undefined horizontalCenter: internalLoader.isVertical ? parent.horizontalCenter : undefined } width: 18 height: 18 svg: scrollbarSvg elementId: { if (leftMouseArea.pressed) { return internalLoader.isVertical ? "sunken-arrow-up" : "sunken-arrow-left" } if (scrollbar.activeFocus || leftMouseArea.containsMouse) { return internalLoader.isVertical ? "mouseover-arrow-up" : "mouseover-arrow-left" } else { return internalLoader.isVertical ? "arrow-up" : "arrow-left" } } MouseArea { id: leftMouseArea anchors.fill: parent enabled: scrollbar.enabled hoverEnabled: true Timer { id: leftTimer interval: scrollbar.scrollButtonInterval; running: parent.pressed repeat: true triggeredOnStart: true onTriggered: { background.forceActiveFocus() if (inverted) { internalLoader.incrementValue(stepSize); } else { internalLoader.incrementValue(-stepSize); } } } } } PlasmaCore.SvgItem { id: rightButton visible: leftButton.visible anchors { right: internalLoader.isVertical ? undefined : parent.right verticalCenter: internalLoader.isVertical ? undefined : parent.verticalCenter bottom: internalLoader.isVertical ? parent.bottom : undefined horizontalCenter: internalLoader.isVertical ? parent.horizontalCenter : undefined } width: 18 height: 18 svg: scrollbarSvg elementId: { if (rightMouseArea.pressed) { return internalLoader.isVertical ? "sunken-arrow-down" : "sunken-arrow-right" } if (scrollbar.activeFocus || rightMouseArea.containsMouse) { return internalLoader.isVertical ? "mouseover-arrow-down" : "mouseover-arrow-right" } else { return internalLoader.isVertical ? "arrow-down" : "arrow-right" } } MouseArea { id: rightMouseArea anchors.fill: parent enabled: scrollbar.enabled hoverEnabled: true Timer { id: rightTimer interval: scrollbar.scrollButtonInterval; running: parent.pressed; repeat: true triggeredOnStart: true onTriggered: { background.forceActiveFocus(); if (inverted) internalLoader.incrementValue(-stepSize); else internalLoader.incrementValue(stepSize); } } } } property MouseArea mouseArea: mouseArea MouseArea { id: mouseArea anchors.fill: contents enabled: scrollbar.enabled hoverEnabled: true drag { target: handle axis: internalLoader.isVertical ? Drag.YAxis : Drag.XAxis minimumX: range.positionAtMinimum maximumX: range.positionAtMaximum minimumY: range.positionAtMinimum maximumY: range.positionAtMaximum } onPressed: { if (internalLoader.isVertical) { // Clamp the value var newY = Math.max(mouse.y, drag.minimumY); newY = Math.min(newY, drag.maximumY); // Debounce the press: a press event inside the handler will not // change its position, the user needs to drag it. if (newY > handle.y + handle.height) { handle.y = mouse.y - handle.height } else if (newY < handle.y) { handle.y = mouse.y } } else { // Clamp the value var newX = Math.max(mouse.x, drag.minimumX); newX = Math.min(newX, drag.maximumX); // Debounce the press: a press event inside the handler will not // change its position, the user needs to drag it. if (newX > handle.x + handle.width) { handle.x = mouse.x - handle.width } else if (newX < handle.x) { handle.x = mouse.x } } background.forceActiveFocus(); } Component.onCompleted: { acceptedButtons |= Qt.MiddleButton } } } diff --git a/src/declarativeimports/plasmacomponents/qml/private/ScrollDecoratorDelegate.qml b/src/declarativeimports/plasmacomponents/qml/private/ScrollDecoratorDelegate.qml index fbf9d7d27..c2746c8e5 100644 --- a/src/declarativeimports/plasmacomponents/qml/private/ScrollDecoratorDelegate.qml +++ b/src/declarativeimports/plasmacomponents/qml/private/ScrollDecoratorDelegate.qml @@ -1,122 +1,122 @@ /* * Copyright (C) 2011 by Daker Fernandes Pinheiro * Copyright (C) 2011 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ import QtQuick 2.1 import org.kde.plasma.core 2.0 as PlasmaCore PlasmaCore.FrameSvgItem { id: background anchors.fill: parent 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 { NumberAnimation { duration: units.longDuration easing.type: Easing.OutQuad } } PlasmaCore.Svg { id: scrollbarSvg imagePath: "widgets/scrollbar" } property Item handle: handle property Item contents: contents Item { id: contents anchors.fill: parent PlasmaCore.FrameSvgItem { id: handle imagePath:"widgets/scrollbar" prefix: "slider" function length() { var nh, ny; if (internalLoader.isVertical) { nh = flickableItem.visibleArea.heightRatio * internalLoader.height } else { nh = flickableItem.visibleArea.widthRatio * internalLoader.width } if (internalLoader.isVertical) { ny = flickableItem.visibleArea.yPosition * internalLoader.height } else { ny = flickableItem.visibleArea.xPosition * internalLoader.width } if (ny > 3) { var t if (internalLoader.isVertical) { t = Math.ceil(internalLoader.height - 3 - ny) } else { t = Math.ceil(internalLoader.width - 3 - ny) } if (nh > t) { return t } else { return nh } } else { return nh + ny } } width: internalLoader.isVertical ? parent.width : length() height: internalLoader.isVertical ? length() : parent.height } } property MouseArea mouseArea: null Connections { target: flickableItem onMovingChanged: { if (flickableItem.moving) { opacityTimer.running = false background.opacity = 1 } else { opacityTimer.restart() } } } Timer { id: opacityTimer interval: 500 repeat: false running: false onTriggered: { background.opacity = 0 } } } diff --git a/src/declarativeimports/plasmastyle/ProgressBarStyle.qml b/src/declarativeimports/plasmastyle/ProgressBarStyle.qml index 303ea7e52..3a924e747 100644 --- a/src/declarativeimports/plasmastyle/ProgressBarStyle.qml +++ b/src/declarativeimports/plasmastyle/ProgressBarStyle.qml @@ -1,110 +1,110 @@ /* * Copyright (C) 2011 by Daker Fernandes Pinheiro * Copyright (C) 2014 by Kai Uwe Broulik * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ import QtQuick 2.2 import QtQuick.Controls.Styles 1.1 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents ProgressBarStyle { id: style 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 imagePath: style.imagePath property int preferredWidth property int preferredHeight onRepaintNeeded: { preferredWidth = barSvg.elementSize("hint-bar-size").width preferredHeight = barSvg.elementSize("hint-bar-size").height if (preferredWidth == 0) { preferredWidth = barSvg.elementSize("bar-inactive-left").width + barSvg.elementSize("bar-inactive-right").width } if (preferredHeight == 0) { preferredHeight = barSvg.elementSize("bar-inactive-top").height + barSvg.elementSize("bar-inactive-bottom").height } } } background: Item { implicitWidth: units.gridUnit * 14 implicitHeight: theme.mSize(theme.defaultFont).height * 1.6 PlasmaCore.FrameSvgItem { anchors.centerIn: parent width: parent.width height: style.implicitHeight imagePath: style.imagePath prefix: "bar-inactive" colorGroup: PlasmaCore.ColorScope.colorGroup } } progress: Item { PlasmaCore.FrameSvgItem { id: progressSvg anchors.verticalCenter: parent.verticalCenter imagePath: style.imagePath prefix: "bar-active" colorGroup: PlasmaCore.ColorScope.colorGroup width: control.indeterminate ? units.gridUnit * 2 : Math.max(margins.left + margins.right, parent.width) height: style.implicitHeight visible: control.indeterminate || currentProgress > 0 SequentialAnimation { id: anim loops: Animation.Infinite running: control.indeterminate && control.visible onRunningChanged: { if (!running) { progressSvg.x = 0 } } PropertyAnimation { target: progressSvg property: "x" duration: 800 // The progress Item's width might be left over from the previous state // so we use the control.width/height directly instead to: control.width - units.gridUnit * 2 onToChanged: { //the animation won't update the boundaries automatically if (anim.running) { anim.restart(); } } } PropertyAnimation { target: progressSvg property: "x" duration: 800 to: 0 } } } } } diff --git a/src/declarativeimports/plasmastyle/ScrollViewStyle.qml b/src/declarativeimports/plasmastyle/ScrollViewStyle.qml index 95760fccd..37951e794 100644 --- a/src/declarativeimports/plasmastyle/ScrollViewStyle.qml +++ b/src/declarativeimports/plasmastyle/ScrollViewStyle.qml @@ -1,252 +1,252 @@ /* * Copyright 2012 Marco Martin * Copyright (C) 2014 by David Edmundson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ import QtQuick 2.0 import QtQuick.Controls.Styles 1.1 as QtQuickControlStyle import QtQuick.Controls.Private 1.0 import org.kde.plasma.core 2.0 as PlasmaCore 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") transientScrollBars: Settings.hasTouchScreen && Settings.isMobile padding { top: 0 left: 0 right: 0 bottom: 0 } function syncVelocity() { if (!control.flickableItem) { return; } // QTBUG-35608 // default values are hardcoded in qtdeclarative/src/quick/items/qquickflickablebehavior_p.h control.flickableItem.flickDeceleration = Math.round(1500 * units.devicePixelRatio); // double maximum speed so it feels better control.flickableItem.maximumFlickVelocity = Math.round(2500 * units.devicePixelRatio); control.flickableItem.interactive = true; } Component.onCompleted: syncVelocity() Connections { target: control onContentItemChanged: syncVelocity() } frame: Item { visible: frameVisible PlasmaCore.Svg { id: borderSvg imagePath: "widgets/scrollwidget" colorGroup: PlasmaCore.ColorScope.colorGroup } PlasmaCore.SvgItem { visible: { if (flickableItem.hasOwnProperty("orientation")) { return (flickableItem.orientation === Qt.Vertical); } return false; } svg: borderSvg z: 1000 elementId: "border-top" width: 100 height: naturalSize.height opacity: !visible || flickableItem.atYBeginning ? 0 : 1 Behavior on opacity { NumberAnimation { duration: units.longDuration easing.type: Easing.InOutQuad } } anchors { left: parent.left top: parent.top right: parent.right } } PlasmaCore.SvgItem { visible: { if (flickableItem.hasOwnProperty("orientation")) { return (flickableItem.orientation === Qt.Vertical); } return false; } svg: borderSvg z: 1000 elementId: "border-bottom" width: 100 height: naturalSize.height opacity: !visible || flickableItem.atYEnd ? 0 : 1 Behavior on opacity { NumberAnimation { duration: units.longDuration easing.type: Easing.InOutQuad } } anchors { left: parent.left bottom: parent.bottom right: parent.right } } PlasmaCore.SvgItem { visible: { if (flickableItem.hasOwnProperty("orientation")) { return (flickableItem.orientation === Qt.Horizontal); } return false; } svg: borderSvg z: 1000 elementId: "border-left" width: naturalSize.width opacity: !visible || flickableItem.atXBeginning ? 0 : 1 Behavior on opacity { NumberAnimation { duration: units.longDuration easing.type: Easing.InOutQuad } } anchors { left: parent.left top: parent.top bottom: parent.bottom } } PlasmaCore.SvgItem { visible: { if (flickableItem.hasOwnProperty("orientation")) { return (flickableItem.orientation === Qt.Horizontal); } return false; } svg: borderSvg z: 1000 elementId: "border-right" width: naturalSize.width opacity: !visible || flickableItem.atXEnd ? 0 : 1 Behavior on opacity { NumberAnimation { duration: units.longDuration easing.type: Easing.InOutQuad } } anchors { top: parent.top bottom: parent.bottom right: parent.right } } } scrollBarBackground: PlasmaCore.FrameSvgItem { imagePath:"widgets/scrollbar" prefix: styleData.horizontal ? "background-horizontal" : "background-vertical" implicitWidth: widthHint colorGroup: PlasmaCore.ColorScope.colorGroup opacity: styleData.hovered ? 1 : 0 Behavior on opacity { NumberAnimation { duration: units.longDuration easing.type: Easing.InOutQuad } } } handle: PlasmaCore.FrameSvgItem { imagePath:"widgets/scrollbar" implicitWidth: widthHint implicitHeight: widthHint colorGroup: PlasmaCore.ColorScope.colorGroup prefix: { if (styleData.hovered) { return "sunken-slider" } if (styleData.pressed) { return "mouseover-slider" } else { return "slider" } } } incrementControl: PlasmaCore.SvgItem { svg: scrollbarSvg visible: scrollbarSvg.arrowPresent //if there is no arrow we don't want to waste space, a tiny margin does look better though implicitWidth: scrollbarSvg.arrowPresent ? widthHint : units.smallSpacing implicitHeight: scrollbarSvg.arrowPresent ? widthHint : units.smallSpacing elementId: { if (styleData.pressed) { return styleData.horizontal ? "sunken-arrow-right" : "sunken-arrow-down" } if (styleData.hovered) { return styleData.horizontal ? "mouseover-arrow-right" : "mouseover-arrow-down" } else { return styleData.horizontal ? "arrow-right" : "arrow-down" } } } decrementControl: PlasmaCore.SvgItem { svg: scrollbarSvg visible: scrollbarSvg.arrowPresent implicitWidth: scrollbarSvg.arrowPresent ? widthHint : units.smallSpacing implicitHeight: scrollbarSvg.arrowPresent ? widthHint : units.smallSpacing elementId: { if (styleData.pressed) { return styleData.horizontal ? "sunken-arrow-left" : "sunken-arrow-up" } if (styleData.hovered) { return styleData.horizontal ? "mouseover-arrow-left" : "mouseover-arrow-up" } else { return styleData.horizontal ? "arrow-left" : "arrow-up" } } } PlasmaCore.Svg { id: scrollbarSvg imagePath: "widgets/scrollbar" property bool arrowPresent: scrollbarSvg.hasElement("arrow-up") //new theme may be different onRepaintNeeded: arrowPresent = scrollbarSvg.hasElement("arrow-up") } } diff --git a/src/declarativeimports/plasmastyle/TableViewStyle.qml b/src/declarativeimports/plasmastyle/TableViewStyle.qml index aa05deafb..2531fcedf 100644 --- a/src/declarativeimports/plasmastyle/TableViewStyle.qml +++ b/src/declarativeimports/plasmastyle/TableViewStyle.qml @@ -1,168 +1,168 @@ /* * Copyright 2014 Digia Plc and/or its subsidiary(-ies). * Copyright 2014 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. */ import QtQuick 2.2 import QtQuick.Controls.Styles 1.2 as QtQuickControlStyle import QtQuick.Controls 1.2 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as PlasmaComponents QtQuickControlStyle.TableViewStyle { id: styleRoot textColor: PlasmaCore.ColorScope.textColor backgroundColor: control.backgroundVisible ? theme.viewBackgroundColor : "transparent" alternateBackgroundColor: Qt.darker(theme.viewBackgroundColor, 1.05) highlightedTextColor: theme.viewTextColor 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" prefix: "normal" enabledBorders: PlasmaCore.FrameSvgItem.TopEdge | PlasmaCore.FrameSvgItem.BottomEdge height: textItem.implicitHeight * 1.2 PlasmaComponents.Label { id: textItem anchors.fill: parent verticalAlignment: Text.AlignVCenter horizontalAlignment: styleData.textAlignment anchors.leftMargin: 12 color: theme.buttonTextColor text: styleData.value elide: Text.ElideRight } Rectangle { anchors.right: parent.right anchors.top: parent.top anchors.bottom: parent.bottom anchors.bottomMargin: 1 anchors.topMargin: 1 width: 1 color: Qt.rgba(PlasmaCore.ColorScope.textColor.r, PlasmaCore.ColorScope.textColor.g, PlasmaCore.ColorScope.textColor.b, 0.2) } } rowDelegate: Rectangle { height: Math.round(units.gridUnit * 1.2) property color selectedColor: styleData.hasActiveFocus ? theme.viewHoverColor: theme.viewFocusColor color: styleData.selected ? selectedColor : !styleData.alternate ? alternateBackgroundColor : theme.viewBackgroundColor } itemDelegate: Item { height: Math.max(16, label.implicitHeight) property int implicitWidth: label.implicitWidth + 20 PlasmaComponents.Label { id: label objectName: "label" width: parent.width anchors.leftMargin: 12 anchors.left: parent.left anchors.right: parent.right horizontalAlignment: styleData.textAlignment anchors.verticalCenter: parent.verticalCenter anchors.verticalCenterOffset: 1 elide: styleData.elideMode text: styleData.value !== undefined ? styleData.value : "" color: theme.viewTextColor } } frame: Item { } scrollBarBackground: PlasmaCore.FrameSvgItem { imagePath:"widgets/scrollbar" prefix: styleData.horizontal ? "background-horizontal" : "background-vertical" implicitWidth: scrollbarWidthHint } handle: PlasmaCore.FrameSvgItem { imagePath:"widgets/scrollbar" implicitWidth: scrollbarWidthHint implicitHeight: scrollbarWidthHint prefix: { if (styleData.hovered) { return "sunken-slider" } if (styleData.pressed) { return "mouseover-slider" } else { return "slider" } } } incrementControl: PlasmaCore.SvgItem { svg: scrollbarSvg visible: scrollbarSvg.arrowPresent //if there is no arrow we don't want to waste space, a tiny margin does look better though implicitWidth: scrollbarSvg.arrowPresent ? scrollbarWidthHint : units.smallSpacing implicitHeight: scrollbarSvg.arrowPresent ? scrollbarWidthHint : units.smallSpacing elementId: { if (styleData.pressed) { return styleData.horizontal ? "sunken-arrow-right" : "sunken-arrow-down" } if (styleData.hovered) { return styleData.horizontal ? "mouseover-arrow-right" : "mouseover-arrow-down" } else { return styleData.horizontal ? "arrow-right" : "arrow-down" } } } decrementControl: PlasmaCore.SvgItem { svg: scrollbarSvg visible: scrollbarSvg.arrowPresent implicitWidth: scrollbarSvg.arrowPresent ? scrollbarWidthHint : units.smallSpacing implicitHeight: scrollbarSvg.arrowPresent ? scrollbarWidthHint : units.smallSpacing elementId: { if (styleData.pressed) { return styleData.horizontal ? "sunken-arrow-left" : "sunken-arrow-up" } if (styleData.hovered) { return styleData.horizontal ? "mouseover-arrow-left" : "mouseover-arrow-up" } else { return styleData.horizontal ? "arrow-left" : "arrow-up" } } } PlasmaCore.Svg { id: scrollbarSvg imagePath: "widgets/scrollbar" property bool arrowPresent: scrollbarSvg.hasElement("arrow-up") //new theme may be different onRepaintNeeded: arrowPresent = scrollbarSvg.hasElement("arrow-up") } }