summaryrefstree
path: root/usr/bin/qml/com/neusoft/auto/widgets/HMIProcessBarDrag.qml
blob: 7fd418571169eca611a4b71f7321ec8e32b1f369 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import QtQuick 2.0

Item {
    id: rectdrag

    property string bgImageStyle: systemCtrl.style

    //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin
    property int xPosition : (barPoint.x+barPoint.width/2) / ((barBackground_Middle.width-22) / 100)
    //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end
    property int enterValue
    property int exportValue  : barPoint.x+barPoint.width/2
    property alias barBackgroundMiddlewidth:barBackground_Middle.width
    property alias barBackgroundMiddleSource: barBackground_Middle.source
    property alias barBlueMiddleSource: barBlue_Middle.source
    property alias barPointSource:  barPoint.source
    property bool pressflag:  false
    property bool dragflag: false
    property bool dragflagpress: false

    property alias barBackgroundMiddleheight: barBackground_Middle.height
    property alias barPointwidth:  barPoint.width
    property alias barPointheight:  barPoint.height
    //ADD [2017-3-24] #160052 pengc begin
    signal sendCancele();
    //ADD [2017-3-24] #160052 pengc end
    signal dragingEnd();
    //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin
    property int totalValue : barBackground_Middle.width-22
    //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end
//Fod #120136 2016/10/18 cxx Start
    //property int barScale:0
    property double barScale:0
//Fod #120136 2016/10/18 cxx End
    signal dragingStart();
    signal barClicked();
    signal moveing();

    height: barPoint.height
    //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin
    Image{
        id:barBackground_Middle
        //update by zlx 2019/1/24 #319233
        x:-6
        y:-12//-14//0
        width:rectdrag.width//rectdrag.width
        //source:"qrc:MATERIAL/MATERIAL_M8X_VIDEO_PROGRESS_BG"+bgImageStyle
        source:"qrc:MATERIAL/MATERIAL_VIDEO_PROGRESS_BG"+bgImageStyle
    }
    //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end
    
    Image{
        id:barBlue_Middle
        //update by zlx 2019/1/24 #319233
        x:5//0
        y:2//0
        width: barPoint.x+barPoint.width/2-2
	//FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin
        //source:"qrc:MATERIAL/MATERIAL_M8X_VIDEO_PROGRESS"+bgImageStyle
        source:"qrc:MATERIAL/MATERIAL_VIDEO_PROGRESS"+bgImageStyle
	//FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end
    }

    Image{
        id:barPoint
        x:-barPoint.width/2+enterValue
        y:-4
	//FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin
        //source:"qrc:MATERIAL/MATERIAL_M8X_VIDEO_PROGRESS_BAR"+bgImageStyle
        source:"qrc:MATERIAL/MATERIAL_VIDEO_PROGRESS_BAR"+bgImageStyle
	//FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end
    }

    HMIMouseArea{
        anchors.fill: barPoint
        //ADD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin
        anchors.rightMargin: 11//0
        anchors.bottomMargin: -13//0
        anchors.leftMargin: 11//0
        anchors.topMargin: -13//0
	//ADD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end
        enabled: dragflagpress
        onReleased: {
               pressflag = false
        }
        onPressed: {
            pressflag = true
        }
        onCanceled: {
            pressflag = false
        }

    }

    HMIMouseArea{
        x: 0
        y: 0
        enabled: dragflag
	//FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin
        anchors.rightMargin: 11//0
        anchors.bottomMargin: -13//0
        anchors.leftMargin: 11//0
        anchors.topMargin: -13//0
        //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end
        anchors.fill: rectdrag//parent
        drag.target: barPoint
        drag.axis: Drag.XAxis
        drag.minimumX:  -barPoint.width/2
	//FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 begin
        drag.maximumX: rectdrag.width-22-barPoint.width/2//rectdrag.width-barPoint.width/2
        //FOD by wangyuecheng 2018/09/12 FOR #BF_IPOD_32 end
	onMouseXChanged: {
                enterValue = barPoint.x +barPoint.width/2
                barScale = (enterValue*100)/totalValue;
                moveing();
        }
        onReleased: {
               dragingEnd();
               pressflag = false
        }
        onPressed: {

            enterValue = mouseX
            barScale = (enterValue*100)/totalValue;
            dragingStart();
            pressflag = true
        }
        onCanceled: {
            //ADD [2017-3-24] #160052 pengc begin
            sendCancele();
            //ADD [2017-3-24] #160052 pengc end
            //DEL [2017-3-24] #160052 pengc begin
            //dragingEnd();
            //DEL [2017-3-24] #160052 pengc end
            pressflag = false
        }
    }
}