blob: b1b6742ccd0f5c85ab5b17d514745b74608dc80b (
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
import QtQuick 2.0
import "../com/neusoft/auto/widgets"
Item {
id: rectdrag
width: sliderMouseAreawidth + barPoint.width
height: barPoint.height
property string bgImageStyle: systemCtrl.styleOld
property int xPosition : (barPoint.x) / (add)
// property alias barPointTXT:barPointText.text
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
property alias barPointWidth: barPoint.width
property alias barPointHeight: barPoint.height
property alias barPoint_X: barPoint.x
property alias barPoint_Y: barPoint.y
property int sliderMouseAreawidth : 100 //slider effective move MouseAreawidth
property int sliderpartnum: 100 //Slider interval count
property double add : (sliderMouseAreawidth / sliderpartnum) //slider'unit of distance
property int sliderMouseX: 0 //effective MouseX
property int sliderbarPointX: 0 //effective barPointX
property int barPointX_backup: 0 //backup barPointX
property int pressedPos : 0 //backup barPointX
property bool sliderIsDisable: false //slider Invalid flag: true-->Invalid;false-->effective
signal clickSlider(); // drag signal
signal addClicked(); // add signal
signal subClicked(); // subtract signal
/*Slider Left Image*/
Image
{
id:barBackground_Left
x:barPoint.width/2
anchors.verticalCenter: parent.verticalCenter
//source: "qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BG_LEFT_OLD"+bgImageStyle
source: "qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BG_LEFT"+bgImageStyle
}
/*Slider Middle Image*/
Image
{
id:barBackground_Middle
width:sliderMouseAreawidth - barBackground_Left.width - barBackground_Right.width
anchors.left: barBackground_Left.right
anchors.verticalCenter: parent.verticalCenter
//source: "qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BG_CENTRE_OLD"+bgImageStyle
source: "qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BG_CENTRE"+bgImageStyle
}
/*Slider Right Image*/
Image
{
id:barBackground_Right
anchors.left:barBackground_Middle.right
anchors.verticalCenter: parent.verticalCenter
//source: "qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BG_RIGHT_OLD"+bgImageStyle
source: "qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BG_RIGHT"+bgImageStyle
}
/* click sliderbar Lift Step - 1 */
HMIMouseArea
{
id:left2barPointmouse_MouseArea
x:0
y:0
height: parent.height
anchors.left: parent.left
anchors.right: barPoint.left
onClicked:
{
if (barPoint.x > pressedPos)
{
barPoint.x = barPoint.x - add;
barPointX_backup = barPoint.x
subClicked();
}
}
onPressed:
{
pressedPos = mouseX;
}
onLongPress:
{
left_timer.start()
}
onReleased:
{
left_timer.stop();
}
onCanceled:
{
left_timer.stop();
}
}
/* click sliderbar Right Step +1*/
HMIMouseArea
{
id:right2barPointmouse_MouseArea
x:0
y:0
height: parent.height
anchors.left: barPoint.right
anchors.right: parent.right
onClicked:
{
if ((barPoint.x) < pressedPos)
{
barPoint.x = barPoint.x + add;
barPointX_backup = barPoint.x
addClicked();
}
}
onPressed:
{
pressedPos = right2barPointmouse_MouseArea.x + mouseX;
}
onLongPress:
{
right_timer.start()
}
onReleased:
{
right_timer.stop();
}
onCanceled:
{
right_timer.stop();
}
}
/*Slider Left Image Disable state*/
Image
{
id:barBlue_Left
anchors.left:barBackground_Left.left
anchors.verticalCenter: parent.verticalCenter
//source: (sliderIsDisable)?"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_D_LEFT_OLD"+bgImageStyle:"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_LEFT_OLD"+bgImageStyle
source: (sliderIsDisable)?"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_D_LEFT"+bgImageStyle:"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_LEFT"+bgImageStyle
}
/*Slider Middle Image Disable state*/
Image
{
id:barBlue_Middle
width: barPoint.x - barBlue_Left.width - barBlue_Right.width
anchors.left:barBlue_Left.right
anchors.verticalCenter: parent.verticalCenter
//source: (sliderIsDisable)?"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_D_CENTRE_OLD"+bgImageStyle:"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_CENTRE_OLD"+bgImageStyle
source: (sliderIsDisable)?"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_D_CENTRE"+bgImageStyle:"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_CENTRE"+bgImageStyle
}
/*Slider Right Image Disable state*/
Image
{
id:barBlue_Right
anchors.left:barPoint.horizontalCenter
anchors.verticalCenter: barBlue_Middle.verticalCenter
//source: (sliderIsDisable)?"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_D_RIGHT_OLD"+bgImageStyle:"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_RIGHT_OLD"+bgImageStyle
source: (sliderIsDisable)?"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_D_RIGHT"+bgImageStyle:"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_RIGHT"+bgImageStyle
}
/*Slider barPoint Image */
Image
{
id:barPoint
x:0
y:0//-13
//width: 12//20
//height:12// 20
source: sliderIsDisable?"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BAR_D"+bgImageStyle:(barPointmouse.pressed?"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BAR_P"+bgImageStyle:"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BAR"+bgImageStyle)
//source: sliderIsDisable?"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BAR_D_OLD"+bgImageStyle:(barPointmouse.pressed?"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BAR_P_OLD"+bgImageStyle:"qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BAR_OLD"+bgImageStyle)
//source: "qrc:MATERIAL/MATERIAL_M8X_PROGRESS_BAR"+bgImageStyle
onXChanged:
{
}
HMIMouseArea
{
id:barPointmouse
x: 0
y: 0
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 0
anchors.topMargin: 0
//width: 10
height: 50
anchors.fill: parent
drag.target: barPoint
drag.axis: "XAxis"
drag.minimumX: 0
drag.maximumX: sliderMouseAreawidth
onReleased:
{
barPoint.x =add*((barPoint.x-barPoint.x%add)/add+((barPoint.x%add)/add>0.5?1:0)); //only barPoint'position > unit of distance of half ,barPoint changed
//DEL shanchulog 2017/1/9 baojinfeng begin
// console.log("onReleased barPointX_backup" + barPointX_backup)
// console.log("onReleased barPoint.x" + barPoint.x)
// console.log("onReleased sliderMouseAreawidth" + sliderMouseAreawidth)
//DEL shanchulog 2017/1/9 baojinfeng end
if ((barPointX_backup != barPoint.x)&&(0 < barPoint.x < sliderMouseAreawidth)) //barPoint have moved and in effective MouseArea
{
barPointX_backup = barPoint.x;
clickSlider();
}
}
onMouseXChanged:
{
barPoint.x =add*((barPoint.x-barPoint.x%add)/add+((barPoint.x%add)/add>0.5?1:0)) //only barPoint'position > unit of distance of half ,barPoint changed
}
}
}
/* click sliderbar left Step timer*/
Timer
{
id:left_timer
interval: 200
running: false
repeat: true
onTriggered:
{
if (barPoint.x > pressedPos)
{
barPoint.x = barPoint.x - add;
subClicked();
}
else
{
left_timer.stop();
}
}
}
/* click sliderbar right timer*/
Timer
{
id:right_timer
interval: 200
running: false
repeat: true
onTriggered:
{
if (((barPoint.x) < pressedPos)&&(0>=pressedPos<=sliderMouseAreawidth))
{
barPoint.x = barPoint.x + add;
addClicked();
}
else
{
right_timer.stop();
}
}
}
}
|