summaryrefstree
path: root/usr/bin/qmldashboard/com/neusoft/auto/widgets/HMIProcessBarDrag.qml
blob: a5bc15131bb942a37b8e0d081e7a71c49ff06b14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import QtQuick 2.0

Item {
    id: rectdrag
    property int xPosition : (barPoint.x+barPoint.width/2-barBlue_Right.width) / (barBackground_Middle.width / 100)
    property int enterValue
    property int exportValue  : barPoint.x+barPoint.width/2-barBlue_Right.width
    property alias barBackgroundMiddlewidth:barBackground_Middle.width
    property alias barBackgroundLeftSource: barBackground_Left.source
    property alias barBackgroundMiddleSource: barBackground_Middle.source
    property alias barBackgroundRightSource:  barBackground_Right.source
    property alias barBlueLeftSource: barBlue_Left.source
    property alias barBlueMiddleSource: barBlue_Middle.source
    property alias barBlueRightSource:  barBlue_Right.source
    property alias barPointSource:  barPoint.source
    signal dragingEnd();

    property int totalValue : barBackground_Middle.width
    property int barScale:0 //0 to 100
    signal dragingStart();
    signal barClicked();

    width: barBackground_Left.width+barBackground_Middle.width+barBackground_Right.width
    height: barPoint.height
    Image{
        id:barBackground_Left
        anchors.verticalCenter: parent.verticalCenter
        source: "../../../../images/Common/Slider/Media/Media_BarBG_L.png"

    }
    Image{
        id:barBackground_Middle
        anchors.left: barBackground_Left.right
        anchors.verticalCenter: parent.verticalCenter
        source:"../../../../images/Common/Slider/Media/Media_BarBG_C.png"
    }
    Image{
        id:barBackground_Right
        anchors.left:barBackground_Middle.right
        anchors.verticalCenter: parent.verticalCenter
        source:"../../../../images/Common/Slider/Media/Media_BarBG_R.png"
    }
    Image{
        id:barBlue_Left
        anchors.left:barBackground_Left.left
        anchors.verticalCenter: parent.verticalCenter
        source:"../../../../images/Common/Slider/Media/Media_Bar_L.png"
    }
    Image{
        id:barBlue_Middle
        width: barPoint.x+barPoint.width/2-2
        anchors.left:barBlue_Left.right
        anchors.verticalCenter: parent.verticalCenter
        source: "../../../../images/Common/Slider/Media/Media_Bar_C.png"

    }
    Image{
        id:barBlue_Right
        anchors.left:barPoint.horizontalCenter
        anchors.verticalCenter: barBlue_Middle.verticalCenter
        source:"../../../../images/Common/Slider/Media/Media_Bar_R.png"
    }


//    HMIMouseArea{
//        id : drag_area

//        x:barBlue_Middle.x
//        width: barBackground_Middle.width
//        height: barPoint.height

//        onClicked: {
//            enterValue = drag_area.mouseX
//            barScale = (enterValue*100)/totalValue;
//            barClicked();
//        }
//    }

    Image{
        id:barPoint
        x:-barPoint.width/2+barBlue_Right.width+enterValue
        source:"../../../../images/Common/Slider/Media/Media_Bar_index.png"
//        MouseArea{
//            x: 0
//            y: 0
//            anchors.rightMargin: 0
//            anchors.bottomMargin: 0
//            anchors.leftMargin: 0
//            anchors.topMargin: 0

//            anchors.fill: parent
//            drag.target: barPoint
//            drag.axis: Drag.XAxis
//            drag.minimumX:  -barPoint.width/2+barBlue_Right.width
//            drag.maximumX: rectdrag.width-barPoint.width/2-barBlue_Right.width
//            onMouseXChanged: {
//               enterValue = barPoint.x +barPoint.width/2-barBlue_Right.width
//               barScale = (enterValue*100)/totalValue;
//            }
//            onReleased: {
//               dragingEnd();
//            }
//            onPressed: {
//               dragingStart();
//            }
//        }
    }
}