aboutsummaryrefslogtreecommitdiffstats
path: root/app/ProgressNextCross.qml
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2018-11-30 13:29:39 +0900
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>2018-11-30 13:29:39 +0900
commitca5835ae771cc3921433b951f25f5207ac3d6999 (patch)
treef08157065e593b650d9f8608dca40882a583d0d4 /app/ProgressNextCross.qml
parent94055f5398b01a58624b3dc91f2f04027ec2a4b5 (diff)
Diffstat (limited to 'app/ProgressNextCross.qml')
-rw-r--r--[-rwxr-xr-x]app/ProgressNextCross.qml99
1 files changed, 29 insertions, 70 deletions
diff --git a/app/ProgressNextCross.qml b/app/ProgressNextCross.qml
index 49765ce..d9e04a5 100755..100644
--- a/app/ProgressNextCross.qml
+++ b/app/ProgressNextCross.qml
@@ -1,86 +1,45 @@
import QtQuick 2.0
import QtQuick.Controls 1.5
+import QtQuick.Controls.Styles 1.4
Item {
id: progress_next_cross
- function move() {
- if(progress_next_cross.state == "0.1"){
- progress_next_cross.state = "0.2"
- } else if(progress_next_cross.state == "0.2"){
- progress_next_cross.state = "0.3"
- } else if(progress_next_cross.state == "0.3"){
- progress_next_cross.state = "0.4"
- } else if(progress_next_cross.state == "0.4"){
- progress_next_cross.state = "0.5"
- } else if(progress_next_cross.state == "0.5"){
- progress_next_cross.state = "0.6"
- } else if(progress_next_cross.state == "0.6"){
- progress_next_cross.state = "0.7"
- } else if(progress_next_cross.state == "0.7"){
- progress_next_cross.state = "0.8"
- } else if(progress_next_cross.state == "0.8"){
- progress_next_cross.state = "0.9"
- } else if(progress_next_cross.state == "0.9"){
- progress_next_cross.state = "1.0"
- } else {
- progress_next_cross.state = "0.1"
- }
+ visible: false
+
+ // val [Input]
+ // distance to next cross. (unit = meter)
+ // when over the ProgressBar.maximumValue/m, progress bar indicates max (same as ProgressBar.maximumValue/m)
+ function setProgress(val) {
+ if ( (0 < val) && (val < bar.maximumValue ) ) {
+ bar.value = val
+ }else if ( bar.maximumValue < val ){
+ bar.value = bar.maximumValue
+ }else{
+ bar.value = 0
+ }
}
ProgressBar {
id: bar
width: 25
height: 100
- orientation: 0
- value: 0.7
+ orientation: Qt.Vertical
+ value: 0
+ minimumValue: 0
+ maximumValue: 300
- MouseArea {
- anchors.fill: parent
- onClicked: { move() }
- }
+ style: ProgressBarStyle {
+ progress: Rectangle {
+ color: "green"
+ }
+ }
}
+ states: [
+ State {
+ name: "visible"; PropertyChanges { target: progress_next_cross; visible: true }},
+ State {
+ name: "invisible"; PropertyChanges { target: progress_next_cross; visible: false }}
+ ]
- states: [
- State {
- name: "0.1"
- PropertyChanges { target: bar; value: 0.1 }
- },
- State {
- name: "0.2"
- PropertyChanges { target: bar; value: 0.2 }
- },
- State {
- name: "0.3"
- PropertyChanges { target: bar; value: 0.3 }
- },
- State {
- name: "0.4"
- PropertyChanges { target: bar; value: 0.4 }
- },
- State {
- name: "0.5"
- PropertyChanges { target: bar; value: 0.5 }
- },
- State {
- name: "0.6"
- PropertyChanges { target: bar; value: 0.6 }
- },
- State {
- name: "0.7"
- PropertyChanges { target: bar; value: 0.7 }
- },
- State {
- name: "0.8"
- PropertyChanges { target: bar; value: 0.8 }
- },
- State {
- name: "0.9"
- PropertyChanges { target: bar; value: 0.9 }
- },
- State {
- name: "1.0"
- PropertyChanges { target: bar; value: 1.0 }
- }
- ]
}