simplify scrolldecorator
This commit is contained in:
parent
896499617d
commit
b5a1397d07
|
@ -24,7 +24,7 @@ Item {
|
||||||
id: scrollDecorator
|
id: scrollDecorator
|
||||||
|
|
||||||
// Common API
|
// Common API
|
||||||
property Flickable flickableItem: null
|
property Flickable flickableItem
|
||||||
|
|
||||||
// Plasma API
|
// Plasma API
|
||||||
property int orientation: Qt.Horizontal
|
property int orientation: Qt.Horizontal
|
||||||
|
@ -36,8 +36,8 @@ Item {
|
||||||
!scrollDecorator.inverted : scrollDecorator.inverted
|
!scrollDecorator.inverted : scrollDecorator.inverted
|
||||||
property alias _value: range.value
|
property alias _value: range.value
|
||||||
|
|
||||||
implicitWidth: _isVertical ? 22 : 200
|
implicitWidth: _isVertical ? 16 : 200
|
||||||
implicitHeight: _isVertical ? 200 : 22
|
implicitHeight: _isVertical ? 200 : 16
|
||||||
|
|
||||||
visible: flickableItem && handle.width < contents.width
|
visible: flickableItem && handle.width < contents.width
|
||||||
|
|
||||||
|
@ -48,15 +48,19 @@ Item {
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
PlasmaCore.Svg {
|
PlasmaCore.FrameSvgItem {
|
||||||
id: scrollDecoratorSvg
|
|
||||||
imagePath: "widgets/scrollDecorator"
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: contents
|
id: contents
|
||||||
|
imagePath: "widgets/scrollbar"
|
||||||
|
prefix: "background-horizontal"
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
opacity: flickableItem && (flickableItem.flicking || flickableItem.moving) ? 1 : 0
|
||||||
|
Behavior on opacity {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: 250
|
||||||
|
easing.type: Easing.OutQuad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RangeModel {
|
RangeModel {
|
||||||
id: range
|
id: range
|
||||||
|
@ -96,30 +100,6 @@ Item {
|
||||||
height: parent.height - margins.top // TODO: check mergin
|
height: parent.height - margins.top // TODO: check mergin
|
||||||
imagePath: "widgets/scrollbar"
|
imagePath: "widgets/scrollbar"
|
||||||
prefix: "slider"
|
prefix: "slider"
|
||||||
opacity: flickableItem && flickableItem.flicking ? 1 : 0
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: flickableItem
|
|
||||||
onMovementStarted: handle.opacity = 1
|
|
||||||
onMovementEnded: opacityAnimation.start()
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on x {
|
|
||||||
PropertyAnimation {
|
|
||||||
duration: 150
|
|
||||||
easing.type: Easing.OutSine
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PropertyAnimation {
|
|
||||||
id: opacityAnimation
|
|
||||||
|
|
||||||
target: handle
|
|
||||||
property: "opacity"
|
|
||||||
from: 1; to: 0
|
|
||||||
duration: 500
|
|
||||||
easing.type: Easing.Linear
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user