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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
|
import QtQuick 2.0
import "../AppLink/Com/"
import "../eventsList.js" as EventsList
import "../layoutList.js" as Layout
import "../windowsList.js" as WindowsList
import "search.js" as Search
import "../AppLink/Com"
import Label 2.0
HMIWindow{
id:app_SrchArea
//windowImgSource:imagePath+"Common/M8X_Background.png"
property int iNum:0
property int iCurpos:0
property bool bkeybrd: false
property bool bFlage: false
property int iMsgType:0
property bool bLoading : true
property bool bSearchDone: false
property bool bIsHideKeyboard: true
property bool bHandWrite:true
title: qsTr("添加城市") + applinkControl.qsEmptyString
onSignal_returnClick:{
text_input.text = ""
systemCtrlLink.inputInfoToClear()
if(Search.FromKeyCrossMain_1 == applinkControl.QML_SSPLink_iGetToSrchArea())
{
ScreenManager.backward(Layout.APPLINK)
}
}
onVisibleChanged: {
if(visible == true)
{
systemCtrlLink.setTextInputHandle(text_input)
}
}
HMIButton{
y: bIsHideKeyboard?1041-160:(bHandWrite?881 - 160:641-160)
btnIcon: imagePath+"Navi/common/M8X_icon_close.png"
btnImg:pressed?imagePath+"Navi/common/M8X_Function_close_Button_p.png":imagePath+"Navi/common/M8X_Function_close_Button.png"
onClicked:{
applinkControl.QML_CloseAppLink()
//ScreenManager.changeForm(Layout.FM_CLOSE,WindowsList.APP_NAVI_SRCHAREA)
}
}
//切换到大分类设施选择画页按钮
HMIButton{
id: allBtn
x: 90
y: bIsHideKeyboard?1041-160:(bHandWrite?881 - 160:641-160)
enabled: false
btnImg: imagePath+"M8X_Function_1_Button_NoSwitch.png"
btnImgOnPressed: imagePath+"M8X_Function_1_Button_NoSwitch_p.png"
}
Component.onCompleted:
{
applinkControl.QML_NIF_Poi_GetNationwideCityList()
}
Item {
visible:true
anchors.left: parent.left
anchors.leftMargin: 58
anchors.top: parent.top
anchors.topMargin: 80
width:844
height:960-80
Image {
id: inputBg
source:imagePath +"Type_L_Weather/L_05_Weather_Add-city/M8X_input.png"
TextInput {
id: text_input
anchors.left: parent.left
anchors.leftMargin: 84
anchors.top: parent.top
anchors.topMargin: 24
width: 16*30
height: parent.height
//cursorVisible: true
focus: false
clip: true
cursorVisible: false
color: "white"
selectionColor:"#434343"
text:""
//font.family: "微软雅黑"
font.pixelSize: 30
autoScroll: true
// onFocusChanged: {
// if (bIsHideKeyboard == true)
// {
// loader_board.source = "../AppLink/Com/HMIHandwriteBrd1.qml"
// text_input.focus = true
// text_input.cursorVisible = true
// }
// }
onContentWidthChanged: {
if(bkeybrd)
{
if(text_input.text.length == 16)
{
loader_board.item.maximumState=true
}
else if(text_input.text.length <16)
{
loader_board.item.maximumState=false
}
}
if (bIsHideKeyboard == false){
if(text_input.text.length>0)
{
if(!bkeybrd)
{
loader_board.item.isDel=true
loader_board.item.isSearch=true
}
else
{
loader_board.item.searchEnable = true
loader_board.item.deleteEnable = true
}
//keyBoard.deleteEnable=true
//handboard.isDel=true
}
else
{
if(!bkeybrd)
{
loader_board.item.isDel=false
loader_board.item.isSearch=false
}
else
{
loader_board.item.searchEnable = false
loader_board.item.deleteEnable = false
}
}
if (bFlage)
{
if(text_input.contentWidth > 30*16)
{
text_input.text = text_input.text.substring(0, text_input.text.length - 1)
}
else
{
bFlage = false
if ( iCurpos < text_input.text.length)
{
text_input.cursorPosition = iCurpos
}
else
{
text_input.cursorPosition = text_input.text.length
}
}
}
// else
// {
// if(bkeybrd)
// {
// console.log("----------lvchangxin-----------------loader_board.item.bStopInput = false-------------------------------")
// loader_board.item.bStopInput = false
// }
// }
}
}
MouseArea{
anchors.fill: parent
enabled:
{
if (bIsHideKeyboard == false){
if(bkeybrd)
{
if(loader_board.item.isPinyin && loader_board.item.searchInfo != "")
{
return true
}
else
{
return false
}
}
else
{
if(loader_board.item.isInput)
{
return true
}
else
{
return false
}
}
}
else{
return false
}
}
}
}
HMILabel{
id: inputInitial
width: parent.width
height: parent.height
anchors.top: parent.top
anchors.left: parent.left
anchors.leftMargin: 84
anchors.verticalCenter: parent.verticalCenter
horizontalAlignment: Text.AlignLeft
color: "#646566"
text: qsTr("请输入城市名称或拼音") + applinkControl.qsEmptyString
visible:text_input.text.length==0?true:false
}
HMIMouseArea{
id:inputBg_Trigger
anchors.fill:inputBg
onClicked: {
if(bIsHideKeyboard){
bIsHideKeyboard = false
text_input.cursorVisible = true
inputBg_Trigger.visible =false
}
}
}
HMIButton{
id:deleteBtn
anchors.right: parent.right
anchors.rightMargin: 25
anchors.verticalCenter: parent.verticalCenter
btnImg: imagePath + "Navi/common/M8X_icon_Clear.png"
btnImgOnPressed: imagePath + "Navi/common/M8X_icon_Clear_p.png"
visible:text_input.text.length>0?true:false
onClicked: {
inputInitial.text=qsTr("请输入城市名称或拼音") + applinkControl.qsEmptyString
tip.visible=true
gridview.visible=true
datalist.visible = false
bIsHideKeyboard = true
text_input.cursorVisible = false
inputBg_Trigger.visible = true
text_input.text = ""
loader_board.item.clearstring()
//loader_board.item.searchEnable = false
//loader_board.item.deleteEnable = false
}
}
}
Rectangle{
id:listArea
x:0
y:241-160
width:842
height:(bIsHideKeyboard == true) ? 720: 320
color: "#00000000"
HMIListView{
id:datalist
anchors.fill: parent
//snapMode:ListView.SnapToRow
boundsBehavior: Flickable.StopAtBounds
delegate: datalistDelegate
clip: true
//visible: bSearchDone
/*onContentYChanged: {
if(count - contentY / WindowsList.listHeight_80 <= 5){
if(!listAdding){
listAdding = true
iTopRecord = contentY / WindowsList.listHeight_80
NaviControl.procGetList(count)
}
}
}*/
}
Component{
id:datalistDelegate
Item {
width:842
height:80
HMIButtonWithCheck{
id:cell_list
btnImgOnCheck: imagePath +"Common/M8X_list_78_p.png"
btnImgOnPressed:imagePath +"Common/M8X_list_78_p.png"
btnImg:imagePath +"Common/M8X_list_78.png"
//bCheck: (datalist.currentIndex == index)?true:false
HMILabel{
x:84
width: 842-40-84
height: parent.height
text:col0
horizontalAlignment: Label.AlignLeft
elide:Label.ElideRight
}
onClicked: {
datalist.currentIndex=index
applinkControl.QML_SSPLink_strSetAreaInfoBySrchdistList(index);
text_input.text = ""
if(Search.FromKeyCrossMain_1 == applinkControl.QML_SSPLink_iGetToSrchArea())
{
ScreenManager.backward(Layout.APPLINK)
}
}
}
}
}
HMIListViewBar{
id: listViewBar
anchors.left: datalist.right
anchors.leftMargin: 26
anchors.top: datalist.top
width: 10
height: (bIsHideKeyboard == true) ? 720: 320//80*4
listView:datalist
scrollBarX:865
scrollBarY:80
visible: datalist.visible?(datalist.count<=(((bIsHideKeyboard == true)?9:4))?false:true):false
clip:true
}
}
HMILabel{
id:tip
x:64
y:80
width:300
height: 80
text:qsTr("选择热门城市") + applinkControl.qsEmptyString
horizontalAlignment: Label.AlignLeft
//visible: (bIsHideKeyboard == true) ? true : false
}
GridView{
id: gridview
clip: true
//anchors.fill: parent
x:0
y:160
width:844
height: (bIsHideKeyboard == true) ? 640: 240
cellWidth: 211//209
cellHeight: 80//78
snapMode:GridView.SnapOneRow
delegate:settinglistdelegate
boundsBehavior: Flickable.StopAtBounds
visible: !bLoading //&& (bIsHideKeyboard == true)
}
Component{
id:settinglistdelegate
HMIButton{
id:cell_id
width:gridview.cellWidth-2//209
height:gridview.cellHeight-2//78
btnImg: imagePath + "Common/M8X_Button_h78_w209.png"
btnImgOnPressed: imagePath + "Common/M8X_Button_h78_w209_p.png"
labelColor: "white"
labelText: col0
onClicked: {
gridview.currentIndex=index
applinkControl.QML_SSPLink_strSetAreaInfoByNCityList(index);
if(Search.FromKeyCrossMain_1 == applinkControl.QML_SSPLink_iGetToSrchArea())
{
ScreenManager.backward(Layout.APPLINK)
}
}
}
}
HMIListViewBar{
id: gradViewBar
anchors.left: gridview.right
anchors.leftMargin: 26
anchors.top: gridview.top
width: 10
height: (bIsHideKeyboard == true) ? 640: 240//80*8
listView:gridview
scrollBarX:865
scrollBarY:160
visible: gridview.visible ? (gridview.count<=((bIsHideKeyboard == true)?32:12)?false:true) : false
clip:true
}
}
Loader{
id: loader_board
source: "../AppLink/Com/HMIHandwriteBrd1.qml"
//x: 5
//y: 721-160
visible: !bIsHideKeyboard
Connections{
target: loader_board.item
onClickspell: {
if(!isPinyin){
systemCtrlLink.setKeyPress(spell)
if (text_input.contentWidth > 30*16 )
{
iCurpos = text_input.cursorPosition
if("——" == spell)
{
text_input.text = text_input.text.substring(0, text_input.text.length - 1)
if (text_input.contentWidth > 30*16 )
{
text_input.text = text_input.text.substring(0, text_input.text.length - 1)
}
}
else
{
text_input.text = text_input.text.substring(0, text_input.text.length - 1)
}
if ( iCurpos < text_input.text.length)
{
text_input.cursorPosition = iCurpos
}
else
{
text_input.cursorPosition = text_input.text.length
}
}
}
}
onClickspace: {
if (text_input.contentWidth > 30*16 )
{
iCurpos = text_input.cursorPosition
text_input.text = text_input.text.substring(0, text_input.text.length - 1)
if ( iCurpos < text_input.text.length)
{
text_input.cursorPosition = iCurpos
}
else
{
text_input.cursorPosition = text_input.text.length
}
}
}
onClickinputtext: {
if (text_input.contentWidth > 30*16 )
{
bFlage = true
iCurpos = text_input.cursorPosition
text_input.text = text_input.text.substring(0, text_input.text.length - 1)
//bFlage = true
}
}
onHandwriteborad:{
bHandWrite=true
//datalist.model = ""
bSearchDone = false
bkeybrd = false
loader_board.source = "../AppLink/Com/HMIHandwriteBrd1.qml"
if(text_input.text.length>0){
loader_board.item.isDel=true
loader_board.item.isSearch=true
}else{
loader_board.item.searchEnable = false
loader_board.item.deleteEnable = false
}
}
onDeleteLongPress: {
text_input.text = ""
//datalist.model = ""
bSearchDone = false
}
onKeyborad: {
bHandWrite=false
//datalist.model = ""
bSearchDone = false
bkeybrd = true
loader_board.source = "../AppLink/Com/HMIKeyBrd1.qml"
if(text_input.text.length>0){
loader_board.item.searchEnable = true
loader_board.item.deleteEnable = true
}else{
loader_board.item.searchEnable = false
loader_board.item.deleteEnable = false
}
if(itype==3)
{
//searchkeyInfo=1
loader_board.item.numberText="CH"
loader_board.item.iType=3
loader_board.item.isPinyin=false
loader_board.item.iQiehuan=1
loader_board.item.isZifu=true
loader_board.item.isSmall= true
//qieHuanKeybrd(3,1,true,false,"")
}
else
{
//searchkeyInfo=1
loader_board.item.iQiehuan=1
loader_board.item.isPinyin=true
loader_board.item.isZifu=false
loader_board.item.searchInfo = ""
loader_board.item.iType=1
//qieHuanKeybrd(1,1,false,true,"")
}
}
onSearchStart: {
if (text_input.text.trim() != "")
{
iMsgType = 5;
msg_PopUp.visible = true
msg_PopUp.opacity = 1
applinkControl.QML_NIF_Poi_SrchDistInfo(text_input.text.trim())
}
else
{
//datalist.model = ""
bSearchDone = false
}
}
onClickSwtich: {
//text_input.text = ""
//text_input.focus = false
//text_input.cursorVisible = true
//bIsHideKeyboard = true
//inputBg_Trigger.visible = true
//datalist.model = ""
//bSearchDone = false
bIsHideKeyboard = true
inputBg_Trigger.visible = true
//loader_board.item.searchEnable = false
//loader_board.item.deleteEnable = false
}
}
}
App_Com_Newspopup{
id:msg_PopUp
z: 3
labelCount: 1
newspopText1: qsTr(applinkControl.QML_getMessageString(iMsgType)) + applinkControl.qsEmptyString
visible:(app_SrchArea.iMsgType > 0)?true:false
opacity: 0
//enabled: false
bIsTouchClear:applinkControl.QML_getMessageTouchClearFlag(iMsgType)
onClicked: {
if(bIsTouchClear){
msg_timer.stop()
iMsgType = 0
msg_PopUp.opacity = 0
msg_PopUp.visible = false
}
}
}
Timer{
id:msg_timer
interval: applinkControl.QML_getMessageTime(iMsgType)
onTriggered: {
iMsgType = 0
msg_PopUp.opacity = 0
msg_PopUp.visible = false
}
}
Connections{
target:applinkControl
onAddrNCityEnd:{
if (app_SrchArea.visible){
//console.log("-------------------------onAddrNCityEnd----------------------")
gridview.model = applinkControl.addrNCityListModel
bLoading = false
}
}
onSearchDistEnd:{
if (app_SrchArea.visible){
console.log("-------------------------onSearchDistEnd----------------------")
iMsgType = 0
msg_PopUp.opacity = 0
msg_PopUp.visible = false
datalist.model = applinkControl.srchdistListModel
bSearchDone = true
tip.visible=false
gridview.visible=false
datalist.visible=true
bIsHideKeyboard=true
inputBg_Trigger.visible = true
}
}
onSearchDistEndNoResult:{
if(app_SrchArea.visible == true)
{
iMsgType = 4
msg_PopUp.opacity = 1
msg_PopUp.visible = true
msg_timer.restart()
//datalist.model = ""
bSearchDone = false
}
}
}
}
|