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 } } } }