diff --git a/declarativeimports/plasmacomponents/Slider.qml b/declarativeimports/plasmacomponents/Slider.qml index 3e980e095..ade0400ca 100644 --- a/declarativeimports/plasmacomponents/Slider.qml +++ b/declarativeimports/plasmacomponents/Slider.qml @@ -45,9 +45,12 @@ Item { width: _isVertical ? 22 : 200 height: _isVertical ? 200 : 22 + // TODO: needs to define if there will be specific graphics for + // disabled sliders + opacity: enabled ? 1.0 : 0.5 Keys.onUpPressed: { - if (!_isVertical) + if (!enabled || !_isVertical) return; if (inverted) @@ -57,6 +60,9 @@ Item { } Keys.onDownPressed: { + if (!enabled || !enabled) + return; + if (!_isVertical) return; @@ -67,7 +73,7 @@ Item { } Keys.onLeftPressed: { - if (_isVertical) + if (!enabled || _isVertical) return; if (inverted) @@ -77,7 +83,7 @@ Item { } Keys.onRightPressed: { - if (_isVertical) + if (!enabled || _isVertical) return; if (inverted) @@ -189,6 +195,7 @@ Item { id: mouseArea anchors.fill: parent + enabled: slider.enabled drag { target: fakeHandle axis: Drag.XAxis diff --git a/declarativeimports/test/gallery/Gallery.qml b/declarativeimports/test/gallery/Gallery.qml index c615d5633..465f47cfd 100644 --- a/declarativeimports/test/gallery/Gallery.qml +++ b/declarativeimports/test/gallery/Gallery.qml @@ -30,8 +30,7 @@ Rectangle { anchors.fill: parent contentWidth: 2200 - contentHeight: 600 -// contentX: 500 + contentHeight: 1000 Row { x: 30 diff --git a/declarativeimports/test/gallery/Sliders.qml b/declarativeimports/test/gallery/Sliders.qml index f7150b588..79825e622 100644 --- a/declarativeimports/test/gallery/Sliders.qml +++ b/declarativeimports/test/gallery/Sliders.qml @@ -90,33 +90,32 @@ Column { } } + Text { text: "Disabled Horizontal Slider" } + PlasmaComponents.Slider { - id: slider1 + id: horizontalSlider width: 140 height: 20 animated: true - Component.onCompleted: { - forceActiveFocus(); + enabled: false + } + + Text { text: "Vertical Slider" } + + Row { + spacing: 30 + PlasmaComponents.Slider { + id: verticalSlider + width: 20 + height: 140 + orientation: Qt.Vertical + minimumValue: 10 + maximumValue: 1000 + stepSize: 50 + inverted: true + animated: true } + Text { text: verticalSlider.value } } - Text { - text: slider1.value - } - - PlasmaComponents.Slider { - id: slider2 - width: 20 - height: 140 - orientation: Qt.Vertical - minimumValue: 10 - maximumValue: 1000 - stepSize: 50 - inverted: true - animated: true - } - - Text { - text: slider2.value - } }