25 changed files with 133 additions and 47 deletions
@ -0,0 +1,20 @@ |
|||||||
|
import QtQuick 2.5 |
||||||
|
|
||||||
|
import QGroundControl.Palette 1.0 |
||||||
|
import QGroundControl.ScreenTools 1.0 |
||||||
|
|
||||||
|
Flickable { |
||||||
|
id: root |
||||||
|
boundsBehavior: Flickable.StopAtBounds |
||||||
|
|
||||||
|
property color indicatorColor: qgcPal.text |
||||||
|
|
||||||
|
QGCPalette { id: qgcPal; colorGroupEnabled: enabled } |
||||||
|
|
||||||
|
Component.onCompleted: { |
||||||
|
var indicatorComponent = Qt.createComponent("QGCFlickableVerticalIndicator.qml") |
||||||
|
indicatorComponent.createObject(root) |
||||||
|
indicatorComponent = Qt.createComponent("QGCFlickableHorizontalIndicator.qml") |
||||||
|
indicatorComponent.createObject(root) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
import QtQuick 2.5 |
||||||
|
|
||||||
|
Rectangle { |
||||||
|
id: horizontalIndicator |
||||||
|
anchors.bottomMargin: 2 |
||||||
|
anchors.bottom: parent.bottom |
||||||
|
x: parent.width * (parent.contentX / parent.contentWidth) |
||||||
|
z: 10 |
||||||
|
height: 2 |
||||||
|
width: parent.width * (parent.width / parent.contentWidth) |
||||||
|
color: parent.indicatorColor |
||||||
|
visible: showIndicator |
||||||
|
|
||||||
|
property bool showIndicator: (parent.flickableDirection == Flickable.AutoFlickDirection || |
||||||
|
parent.flickableDirection == Flickable.HorizontalFlick || |
||||||
|
parent.flickableDirection == Flickable.HorizontalAndVerticalFlick) && |
||||||
|
(parent.contentWidth > parent.width) |
||||||
|
|
||||||
|
Component.onCompleted: animateOpacity.restart() |
||||||
|
onVisibleChanged: animateOpacity.restart() |
||||||
|
onWidthChanged: animateOpacity.restart() |
||||||
|
|
||||||
|
Connections { |
||||||
|
target: horizontalIndicator.parent |
||||||
|
onMovementStarted: horizontalIndicator.opacity = 1.0 |
||||||
|
onMovementEnded: animateOpacity.restart() |
||||||
|
onContentHeightChanged: animateOpacity.restart() |
||||||
|
} |
||||||
|
|
||||||
|
NumberAnimation { |
||||||
|
id: animateOpacity |
||||||
|
target: horizontalIndicator |
||||||
|
properties: "opacity" |
||||||
|
from: 1.0 |
||||||
|
to: 0.0 |
||||||
|
duration: 1000 |
||||||
|
easing.type: Easing.InQuint |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
import QtQuick 2.5 |
||||||
|
|
||||||
|
Rectangle { |
||||||
|
id: verticalIndicator |
||||||
|
anchors.rightMargin: 2 |
||||||
|
anchors.right: parent.right |
||||||
|
y: parent.height * (parent.contentY / parent.contentHeight) |
||||||
|
z: 10 |
||||||
|
width: 2 |
||||||
|
height: parent.height * (parent.height / parent.contentHeight) |
||||||
|
color: parent.indicatorColor |
||||||
|
visible: showIndicator |
||||||
|
|
||||||
|
property bool showIndicator: (parent.flickableDirection == Flickable.AutoFlickDirection || |
||||||
|
parent.flickableDirection == Flickable.VerticalFlick || |
||||||
|
parent.flickableDirection == Flickable.HorizontalAndVerticalFlick) && |
||||||
|
(parent.contentHeight > parent.height) |
||||||
|
|
||||||
|
Component.onCompleted: animateOpacity.restart() |
||||||
|
onVisibleChanged: animateOpacity.restart() |
||||||
|
onHeightChanged: animateOpacity.restart() |
||||||
|
|
||||||
|
Connections { |
||||||
|
target: verticalIndicator.parent |
||||||
|
onMovementStarted: verticalIndicator.opacity = 1.0 |
||||||
|
onMovementEnded: animateOpacity.restart() |
||||||
|
onContentHeightChanged: animateOpacity.restart() |
||||||
|
} |
||||||
|
|
||||||
|
NumberAnimation { |
||||||
|
id: animateOpacity |
||||||
|
target: verticalIndicator |
||||||
|
properties: "opacity" |
||||||
|
from: 1.0 |
||||||
|
to: 0.0 |
||||||
|
duration: 1000 |
||||||
|
easing.type: Easing.InQuint |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue