use hint-scrollbar-size for size

support themes without scrollbar arrows
This commit is contained in:
Marco Martin 2012-10-09 19:38:23 +02:00
parent fa82e27049
commit b50652c805
3 changed files with 17 additions and 8 deletions

View File

@ -104,8 +104,8 @@ Item {
property bool pressed: internalLoader.item.mouseArea?internalLoader.item.mouseArea.pressed:false
property real scrollButtonInterval: 50
implicitWidth: internalLoader.isVertical ? (interactive ? 16 : 12) : 200
implicitHeight: internalLoader.isVertical ? 200 : (interactive ? 16 : 12)
implicitWidth: internalLoader.isVertical ? (internalLoader.item ? internalLoader.item.implicitWidth : 12) : 200
implicitHeight: internalLoader.isVertical ? 200 : (internalLoader.item ? internalLoader.item.implicitHeight : 12)
// TODO: needs to define if there will be specific graphics for
// disabled scroll bars
opacity: enabled ? 1.0 : 0.5

View File

@ -28,6 +28,9 @@ 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 : 12
property int implicitHeight: scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").height : 12
Keys.onUpPressed: {
if (!enabled || !internalLoader.isVertical)
return;
@ -75,10 +78,10 @@ PlasmaCore.FrameSvgItem {
id: contents
anchors {
fill: parent
leftMargin: internalLoader.isVertical || stepSize <= 0 ? 0 : leftButton.width
rightMargin: internalLoader.isVertical || stepSize <= 0 ? 0 : rightButton.width
topMargin: internalLoader.isVertical && stepSize > 0 ? leftButton.height : 0
bottomMargin: internalLoader.isVertical && stepSize > 0 ? rightButton.height : 0
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 {
@ -106,11 +109,14 @@ PlasmaCore.FrameSvgItem {
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
visible: stepSize > 0 && scrollbarSvg.arrowPresent
anchors {
left: internalLoader.isVertical ? undefined : parent.left
@ -160,7 +166,7 @@ PlasmaCore.FrameSvgItem {
PlasmaCore.SvgItem {
id: rightButton
visible: stepSize > 0
visible: leftButton.visible
anchors {
right: internalLoader.isVertical ? undefined : parent.right

View File

@ -28,6 +28,9 @@ 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 : 12
property int implicitHeight: scrollbarSvg.hasElement("hint-scrollbar-size") ? scrollbarSvg.elementSize("hint-scrollbar-size").height : 12
opacity: 0
Behavior on opacity {
NumberAnimation {