App.qml 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2021 The Qt Company Ltd.
  4. ** Contact: https://www.qt.io/licensing/
  5. **
  6. ** This file is part of Qt Quick Studio Components.
  7. **
  8. ** $QT_BEGIN_LICENSE:GPL$
  9. ** Commercial License Usage
  10. ** Licensees holding valid commercial Qt licenses may use this file in
  11. ** accordance with the commercial license agreement provided with the
  12. ** Software or, alternatively, in accordance with the terms contained in
  13. ** a written agreement between you and The Qt Company. For licensing terms
  14. ** and conditions see https://www.qt.io/terms-conditions. For further
  15. ** information use the contact form at https://www.qt.io/contact-us.
  16. **
  17. ** GNU General Public License Usage
  18. ** Alternatively, this file may be used under the terms of the GNU
  19. ** General Public License version 3 or (at your option) any later version
  20. ** approved by the KDE Free Qt Foundation. The licenses are as published by
  21. ** the Free Software Foundation and appearing in the file LICENSE.GPL3
  22. ** included in the packaging of this file. Please review the following
  23. ** information to ensure the GNU General Public License requirements will
  24. ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
  25. **
  26. ** $QT_END_LICENSE$
  27. **
  28. ****************************************************************************/
  29. import QtQuick
  30. import QtQuick.Window
  31. import QtQuick.Controls
  32. //import IOT_UI
  33. Window {
  34. id: window
  35. width: Qt.platform.os === "android" ? Screen.width: 1280
  36. height: Qt.platform.os === "android"? Screen.height: 800
  37. // minimumWidth: 1280
  38. // minimumHeight: 800
  39. visible: true
  40. title: "Application iot"
  41. Login {
  42. id: loginScreen
  43. width: Qt.platform.os === "android" ? Screen.width: 1280
  44. height: Qt.platform.os === "android"? Screen.height: 800
  45. color: "#051f58"
  46. radius: 8
  47. visible: true
  48. Component.onCompleted: {
  49. timer_time.start()
  50. }
  51. loginbtn.onClicked: {
  52. login_start()
  53. }
  54. timer_time.onTriggered:
  55. {
  56. element.text = currentDateTime();
  57. }
  58. function login_start()
  59. {
  60. //console.log("initdata:",myClass.getdata_JsonArray())
  61. if(loginpwd.text==="8888")
  62. {
  63. mainScreen.visible = true
  64. loginScreen.visible = false
  65. }
  66. else if(loginpwd.text==="0000")
  67. {
  68. sql_Screen.visible = true
  69. mainScreen.visible = false
  70. loginScreen.visible = false
  71. }
  72. else
  73. {
  74. loginpwd.text="密码输入错误"
  75. }
  76. }
  77. //当前时间
  78. function currentDateTime(){
  79. return Qt.formatDateTime(new Date(), "yyyy-MM-dd hh:mm:ss");
  80. }
  81. }
  82. SqlScreen {
  83. id: sql_Screen
  84. width: Qt.platform.os === "android" ? Screen.width: 1280
  85. height: Qt.platform.os === "android"? Screen.height: 800
  86. visible: false
  87. }
  88. Screen01 {
  89. id: mainScreen
  90. width: Qt.platform.os === "android" ? Screen.width: 1280
  91. height: Qt.platform.os === "android"? Screen.height: 800
  92. visible: false
  93. z: 1
  94. recDataPage.onWidthChanged: {
  95. if(recDataPage.width <= 524) recDataPage.width = 524
  96. else if(recDataPage.width >= 600) recDataPage.width = 600
  97. }
  98. function recDataDisplay(recByte) {
  99. // 停止显示是否选中
  100. if (rxEN_btn.highlighted) {
  101. // ASCII/HEX显示 和 日志显示 在后者函数的两个参数里
  102. recDataEdit.insert(recDataEdit.length, myClass.get_recData(myClass.get_pageIndex(), rxCode_btn.text, displayDate_btn.highlighted))
  103. }
  104. rxByteText.text = recByte
  105. }
  106. function recDataMessage()
  107. {
  108. }
  109. function sendDataDisplay(sendByte) {
  110. txByteText.text = sendByte
  111. if (txEN_btn.highlighted) {
  112. recDataEdit.insert(recDataEdit.length, myClass.get_sendData(rxCode_btn.text, displayDate_btn.highlighted))
  113. }
  114. }
  115. slider_color.onMoved: {
  116. serial_ip_page.color = Qt.rgba((slider_color.value % 5 / 5.0).toFixed(1), (slider_color.value % 25 / 5 / 5.0).toFixed(1), (slider_color.value / 25 / 5.0).toFixed(1), 1)
  117. if(slider_color.value === 0.0 || slider_color.value === 125.0)
  118. {
  119. serial_ip_page.color = "#20000000"
  120. }
  121. //console.log(slider_color.value, (slider_color.value % 5 / 5.0).toFixed(1), (slider_color.value % 25 / 5 / 5.0).toFixed(1), (slider_color.value / 25 / 5.0).toFixed(1))
  122. }
  123. data_originEdit.onTextChanged: {
  124. myClass.on_originData_textChanged(data_originEdit.getText(0, data_originEdit.length))
  125. data_englishByteTextinput.text = myClass.get_enBytes()
  126. data_chineseByteTextinput.text = myClass.get_zh_cnBytes()
  127. }
  128. data_changeBtn.onClicked: {
  129. data_originEdit.textFormat = TextEdit.PlainText
  130. data_originEdit.text = myClass.on_changeBtn_clicked(data_originEdit.getText(0, data_originEdit.length), data_codeCombo.currentIndex)
  131. }
  132. data_fine2Btn.onClicked: {
  133. data_originEdit.textFormat = TextEdit.AutoText
  134. data_originEdit.text = myClass.on_findBtn2_clicked(data_originEdit.getText(0, data_originEdit.length), data_target1Edit.getText(0, data_target1Edit.length))
  135. }
  136. data_fine1Btn.onClicked: {
  137. data_originEdit.textFormat = TextEdit.AutoText
  138. data_originEdit.text = myClass.on_findBtn1_clicked(data_originEdit.getText(0, data_originEdit.length), data_target1Edit.getText(0, data_target1Edit.length))
  139. }
  140. data_deleta2Btn.onClicked: {
  141. data_originEdit.textFormat = TextEdit.AutoText
  142. data_originEdit.text = myClass.on_deleteBtn2_clicked(data_originEdit.getText(0, data_originEdit.length), data_target1Edit.getText(0, data_target1Edit.length), data_target2Edit.getText(0, data_target2Edit.length))
  143. }
  144. data_deleta1Btn.onClicked: {
  145. //console.log(data_originEdit.getText(0, data_originEdit.length))
  146. data_originEdit.textFormat = TextEdit.AutoText
  147. data_originEdit.text = myClass.on_deleteBtn1_clicked(data_originEdit.getText(0, data_originEdit.length), data_target1Edit.getText(0, data_target1Edit.length), data_target2Edit.getText(0, data_target2Edit.length))
  148. }
  149. data_target2TitleMouse.onClicked: {
  150. myClass.on_targetTitle2_clicked()
  151. }
  152. data_target1TitleMouse.onClicked: {
  153. myClass.on_targetTitle1_clicked()
  154. }
  155. data_originTitleMouse.onClicked: {
  156. myClass.on_originTitle_clicked()
  157. }
  158. data_target2Mouse.onWheel: function(wheel){
  159. if (wheel.angleDelta.y > 0) {
  160. data_vbar3.decrease()
  161. }
  162. else {
  163. data_vbar3.increase()
  164. }
  165. }
  166. data_target1Mouse.onWheel: function(wheel){
  167. if (wheel.angleDelta.y > 0) {
  168. data_vbar2.decrease()
  169. }
  170. else {
  171. data_vbar2.increase()
  172. }
  173. }
  174. data_originMouse.onWheel: function(wheel){
  175. if (wheel.angleDelta.y > 0) {
  176. data_vbar1.decrease()
  177. }
  178. else {
  179. data_vbar1.increase()
  180. }
  181. }
  182. data_target2Mouse.onClicked: {
  183. data_target2Edit.forceActiveFocus()
  184. }
  185. data_target1Mouse.onClicked: {
  186. data_target1Edit.forceActiveFocus()
  187. }
  188. data_originMouse.onClicked: {
  189. data_originEdit.forceActiveFocus()
  190. }
  191. /****************************serial ip*********************************/
  192. ip_switch.onClicked: {
  193. if(ip_switch.checked)
  194. {
  195. ip_nameCombo.enabled = false
  196. ip_myAddrText.enabled = false
  197. ip_myPortText.enabled = false
  198. ip_otherAddrText.enabled = false
  199. ip_otherPortText.enabled = false
  200. }
  201. else
  202. {
  203. ip_nameCombo.enabled = true
  204. ip_myAddrText.enabled = true
  205. ip_myPortText.enabled = true
  206. ip_otherAddrText.enabled = true
  207. ip_otherPortText.enabled = true
  208. }
  209. myClass.on_ipSwitch_clicked(ip_switch.checked, ip_myAddrText.text, ip_myPortText.text, ip_otherAddrText.text, ip_otherPortText.text);
  210. }
  211. subButton.onClicked: {
  212. myClass.on_subButton_clicked(subField.text);
  213. }
  214. ip_nameCombo.onCurrentIndexChanged: {
  215. myClass.set_pageIndex(ip_nameCombo.currentIndex+2)
  216. txByteText.text = myClass.get_RxTxByte(myClass.get_pageIndex()*2)
  217. rxByteText.text = myClass.get_RxTxByte(myClass.get_pageIndex()*2-1)
  218. switch(ip_nameCombo.currentIndex)
  219. {
  220. case 0: //TCP Client
  221. ip_myAddrText.enabled = false
  222. ip_myPortText.enabled = false
  223. ip_otherAddrText.enabled = true
  224. ip_otherPortText.enabled = true
  225. break;
  226. case 1: //TCP Server
  227. ip_myAddrText.enabled = true
  228. ip_myPortText.enabled = true
  229. ip_otherAddrText.enabled = false
  230. ip_otherPortText.enabled = false
  231. break;
  232. case 2: //UDP
  233. ip_myAddrText.enabled = true
  234. ip_myPortText.enabled = true
  235. ip_otherAddrText.enabled = true
  236. ip_otherPortText.enabled = true
  237. break;
  238. case 3: //MQTT
  239. ip_myAddrText.enabled = false
  240. ip_myPortText.enabled = false
  241. ip_otherAddrText.enabled = true
  242. ip_otherPortText.enabled = true
  243. break;
  244. }
  245. }
  246. txClearBtn.onClicked: {
  247. myClass.clear_RxTxByte(myClass.get_pageIndex()*2)
  248. txByteText.text = 0
  249. }
  250. rxClearBtn.onClicked: {
  251. myClass.clear_RxTxByte(myClass.get_pageIndex()*2-1)
  252. rxByteText.text = 0
  253. }
  254. serial_nameCombo.onPressedChanged: {
  255. serial_nameCombo.model = myClass.get_serialName()
  256. }
  257. serial_nameCombo.onCurrentTextChanged: {
  258. if(serial_nameCombo.currentIndex >= 0)
  259. {
  260. serial_descriptionLab.text = myClass.get_serialDescription(serial_nameCombo.currentIndex)
  261. }
  262. }
  263. txAutoSend_btn.onClicked: {
  264. if(serial_switch.checked || ip_switch.checked)
  265. {
  266. txAutoSend_btn.highlighted = !txAutoSend_btn.highlighted
  267. myClass.on_autoSend_clicked(txAutoSend_btn.highlighted, autoSendTime.text)
  268. }
  269. else
  270. {
  271. serial_switch.highlighted = true
  272. ip_switch.highlighted = true
  273. }
  274. }
  275. serial_switch.onCheckedChanged: {
  276. serial_switch.highlighted = false
  277. if(serial_switch.checked)
  278. {
  279. serial_nameCombo.enabled = false
  280. serial_boudCombo.enabled = false
  281. serial_checkBitCombo.enabled = false
  282. serial_dataBitCombo.enabled = false
  283. serial_stopBitCombo.enabled = false
  284. }
  285. else
  286. {
  287. serial_nameCombo.enabled = true
  288. serial_boudCombo.enabled = true
  289. serial_checkBitCombo.enabled = true
  290. serial_dataBitCombo.enabled = true
  291. serial_stopBitCombo.enabled = true
  292. }
  293. myClass.on_serial_switch_clicked(serial_switch.checked, serial_nameCombo.currentText, serial_boudCombo.currentText)
  294. }
  295. txSend_btn.onClicked: {
  296. if(serial_switch.checked || ip_switch.checked)
  297. {
  298. myClass.set_sendDate(myClass.get_pageIndex(), sendDataEdit.getText(0, sendDataEdit.length), txSuffixCombo.currentIndex, txCode_btn.text)
  299. }
  300. else
  301. {
  302. serial_switch.highlighted = true
  303. ip_switch.highlighted = true
  304. }
  305. }
  306. txClear_btn.onClicked: {
  307. sendDataEdit.clear()
  308. }
  309. txCode_btn.onClicked: {
  310. txCode_btn.text = txCode_btn.text !== "ASCII" ? "ASCII" : "HEX"
  311. }
  312. rxClear_btn.onClicked: {
  313. recDataEdit.clear()
  314. }
  315. saveFile_btn.onClicked: {
  316. myClass.on_save_file_clicked(recDataEdit.getText(0, recDataEdit.length))
  317. }
  318. displayDate_btn.onClicked: {
  319. displayDate_btn.highlighted = !displayDate_btn.highlighted
  320. }
  321. // 文本变化就滑动滑动条到底
  322. recDataEdit.onTextChanged: {
  323. vbar1.increase()
  324. }
  325. recDataMouse.onClicked: {
  326. // MouseArea点击后将焦点给到TextEdit
  327. recDataEdit.forceActiveFocus()
  328. }
  329. recDataMouse.onWheel: function(wheel){
  330. // 鼠标滚轮位置
  331. if (wheel.angleDelta.y > 0) {
  332. // ScrollBar移动
  333. vbar1.decrease()
  334. }
  335. else {
  336. vbar1.increase()
  337. }
  338. }
  339. sendDataMouse.onClicked: {
  340. sendDataEdit.forceActiveFocus()
  341. }
  342. sendDataMouse.onWheel: function(wheel){
  343. console.log(wheel.angleDelta.y)
  344. if (wheel.angleDelta.y > 0) {
  345. vbar2.decrease()
  346. }
  347. else {
  348. vbar2.increase()
  349. }
  350. }
  351. rxCode_btn.onClicked: {
  352. rxCode_btn.text = rxCode_btn.text !== "ASCII" ? "ASCII" : "HEX"
  353. }
  354. txEN_btn.onClicked: {
  355. txEN_btn.highlighted = !txEN_btn.highlighted
  356. }
  357. rxEN_btn.onClicked: {
  358. rxEN_btn.highlighted = !rxEN_btn.highlighted
  359. }
  360. tabBar.onCurrentIndexChanged: {
  361. switch(tabBar.currentIndex)
  362. {
  363. case 0:
  364. // visible显示/隐藏
  365. myMouseArea.visible = true
  366. serial_leftSidePage.visible = true
  367. ip_leftSidePage.visible = false
  368. data_page.visible = false
  369. test_page.visible = false
  370. myClass.set_pageIndex(tabBar.currentIndex+1)
  371. txByteText.text = myClass.get_RxTxByte(myClass.get_pageIndex()*2)
  372. rxByteText.text = myClass.get_RxTxByte(myClass.get_pageIndex()*2-1)
  373. break
  374. case 1:
  375. myMouseArea.visible = true
  376. serial_leftSidePage.visible = false
  377. ip_leftSidePage.visible = true
  378. data_page.visible = false
  379. test_page.visible = false
  380. myClass.set_pageIndex(ip_nameCombo.currentIndex+2)
  381. txByteText.text = myClass.get_RxTxByte(myClass.get_pageIndex()*2)
  382. rxByteText.text = myClass.get_RxTxByte(myClass.get_pageIndex()*2-1)
  383. switch(ip_nameCombo.currentIndex)
  384. {
  385. case 0:
  386. ip_myAddrText.enabled = false
  387. ip_myPortText.enabled = false
  388. ip_otherAddrText.enabled = true
  389. ip_otherPortText.enabled = true
  390. break;
  391. case 1:
  392. ip_myAddrText.enabled = true
  393. ip_myPortText.enabled = true
  394. ip_otherAddrText.enabled = false
  395. ip_otherPortText.enabled = false
  396. break;
  397. case 2:
  398. ip_myAddrText.enabled = true
  399. ip_myPortText.enabled = true
  400. ip_otherAddrText.enabled = true
  401. ip_otherPortText.enabled = true
  402. break;
  403. }
  404. break
  405. case 2:
  406. myMouseArea.visible = false
  407. data_page.visible = true
  408. test_page.visible = false
  409. break
  410. case 3:
  411. myMouseArea.visible = false
  412. data_page.visible = false
  413. test_page.visible = true
  414. break
  415. }
  416. }
  417. /*********************************************快捷内容框内容本地存储**************************************************/
  418. // shortcut_CtrlText1.onTextChanged: {
  419. // myClass.shortcut_data_save(1, shortcut_CtrlText1.text)
  420. // }
  421. // shortcut_CtrlText2.onTextChanged: {
  422. // myClass.shortcut_data_save(2, shortcut_CtrlText2.text)
  423. // }
  424. // shortcut_CtrlText3.onTextChanged: {
  425. // myClass.shortcut_data_save(3, shortcut_CtrlText3.text)
  426. // }
  427. // shortcut_CtrlText4.onTextChanged: {
  428. // myClass.shortcut_data_save(4, shortcut_CtrlText4.text)
  429. // }
  430. // shortcut_CtrlText5.onTextChanged: {
  431. // myClass.shortcut_data_save(5, shortcut_CtrlText5.text)
  432. // }
  433. // shortcut_AltText1.onTextChanged: {
  434. // myClass.shortcut_data_save(6, shortcut_AltText1.text)
  435. // }
  436. // shortcut_AltText2.onTextChanged: {
  437. // myClass.shortcut_data_save(7, shortcut_AltText2.text)
  438. // }
  439. // shortcut_AltText3.onTextChanged: {
  440. // myClass.shortcut_data_save(8, shortcut_AltText3.text)
  441. // }
  442. // shortcut_AltText4.onTextChanged: {
  443. // myClass.shortcut_data_save(9, shortcut_AltText4.text)
  444. // }
  445. // shortcut_AltText5.onTextChanged: {
  446. // myClass.shortcut_data_save(10, shortcut_AltText5.text)
  447. // }
  448. // shortcut_Texta.onTextChanged: {
  449. // myClass.shortcut_data_save(11, shortcut_Texta.text)
  450. // }
  451. // shortcut_Textb.onTextChanged: {
  452. // myClass.shortcut_data_save(12, shortcut_Textb.text)
  453. // }
  454. // shortcut_Textc.onTextChanged: {
  455. // myClass.shortcut_data_save(13, shortcut_Textc.text)
  456. // }
  457. // shortcut_Textd.onTextChanged: {
  458. // myClass.shortcut_data_save(14, shortcut_Textd.text)
  459. // }
  460. // shortcut_Texte.onTextChanged: {
  461. // myClass.shortcut_data_save(15, shortcut_Texte.text)
  462. // }
  463. // shortcut_Textf.onTextChanged: {
  464. // myClass.shortcut_data_save(16, shortcut_Textf.text)
  465. // }
  466. // shortcut_Textg.onTextChanged: {
  467. // myClass.shortcut_data_save(17, shortcut_Textg.text)
  468. // }
  469. // shortcut_Texth.onTextChanged: {
  470. // myClass.shortcut_data_save(18, shortcut_Texth.text)
  471. // }
  472. // shortcut_Texti.onTextChanged: {
  473. // myClass.shortcut_data_save(19, shortcut_Texti.text)
  474. // }
  475. /*********************************************快捷内容发送按键**************************************************/
  476. shortcut_Btn1.onClicked: {
  477. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_CtrlText1.text, txSuffixCombo.currentIndex, txCode_btn.text)
  478. }
  479. shortcut_Btn2.onClicked: {
  480. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_CtrlText2.text, txSuffixCombo.currentIndex, txCode_btn.text)
  481. }
  482. shortcut_Btn3.onClicked: {
  483. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_CtrlText3.text, txSuffixCombo.currentIndex, txCode_btn.text)
  484. }
  485. shortcut_Btn4.onClicked: {
  486. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_CtrlText4.text, txSuffixCombo.currentIndex, txCode_btn.text)
  487. }
  488. shortcut_Btn5.onClicked: {
  489. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_CtrlText5.text, txSuffixCombo.currentIndex, txCode_btn.text)
  490. }
  491. shortcut_Btn6.onClicked: {
  492. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_AltText1.text, txSuffixCombo.currentIndex, txCode_btn.text)
  493. }
  494. shortcut_Btn7.onClicked: {
  495. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_AltText2.text, txSuffixCombo.currentIndex, txCode_btn.text)
  496. }
  497. shortcut_Btn8.onClicked: {
  498. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_AltText3.text, txSuffixCombo.currentIndex, txCode_btn.text)
  499. }
  500. shortcut_Btn9.onClicked: {
  501. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_AltText4.text, txSuffixCombo.currentIndex, txCode_btn.text)
  502. }
  503. shortcut_Btn10.onClicked: {
  504. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_AltText5.text, txSuffixCombo.currentIndex, txCode_btn.text)
  505. }
  506. shortcut_Btn11.onClicked: {
  507. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Texta.text, txSuffixCombo.currentIndex, txCode_btn.text)
  508. }
  509. shortcut_Btn12.onClicked: {
  510. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Textb.text, txSuffixCombo.currentIndex, txCode_btn.text)
  511. }
  512. shortcut_Btn13.onClicked: {
  513. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Textc.text, txSuffixCombo.currentIndex, txCode_btn.text)
  514. }
  515. shortcut_Btn14.onClicked: {
  516. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Textd.text, txSuffixCombo.currentIndex, txCode_btn.text)
  517. }
  518. shortcut_Btn15.onClicked: {
  519. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Texte.text, txSuffixCombo.currentIndex, txCode_btn.text)
  520. }
  521. shortcut_Btn16.onClicked: {
  522. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Textf.text, txSuffixCombo.currentIndex, txCode_btn.text)
  523. }
  524. shortcut_Btn17.onClicked: {
  525. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Textg.text, txSuffixCombo.currentIndex, txCode_btn.text)
  526. }
  527. shortcut_Btn18.onClicked: {
  528. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Texth.text, txSuffixCombo.currentIndex, txCode_btn.text)
  529. }
  530. shortcut_Btn19.onClicked: {
  531. myClass.set_sendDate(myClass.get_pageIndex(), shortcut_Texti.text, txSuffixCombo.currentIndex, txCode_btn.text)
  532. }
  533. /*********************************************快捷方式/快捷键**************************************************/
  534. Shortcut {
  535. sequence: "Ctrl+Q"
  536. onActivated: mainScreen.txCode_btn.clicked()
  537. }
  538. Shortcut {
  539. sequence: "Ctrl+W"
  540. onActivated: mainScreen.sendDataEdit.clear()
  541. }
  542. Shortcut {
  543. sequence: "Ctrl+E"
  544. onActivated: mainScreen.txSend_btn.clicked()
  545. }
  546. Shortcut {
  547. sequence: "Ctrl+R"
  548. onActivated: mainScreen.txAutoSend_btn.clicked()
  549. }
  550. Shortcut {
  551. sequence: "Alt+1"
  552. onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_AltText1.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
  553. }
  554. Shortcut {
  555. sequence: "Alt+2"
  556. onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_AltText2.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
  557. }
  558. Shortcut {
  559. sequence: "Alt+3"
  560. onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_AltText3.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
  561. }
  562. Shortcut {
  563. sequence: "Alt+4"
  564. onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_AltText4.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
  565. }
  566. Shortcut {
  567. sequence: "Alt+5"
  568. onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_AltText5.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
  569. }
  570. Shortcut {
  571. sequence: "Ctrl+1"
  572. onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_CtrlText1.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
  573. }
  574. Shortcut {
  575. sequence: "Ctrl+2"
  576. onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_CtrlText2.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
  577. }
  578. Shortcut {
  579. sequence: "Ctrl+3"
  580. onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_CtrlText3.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
  581. }
  582. Shortcut {
  583. sequence: "Ctrl+4"
  584. onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_CtrlText4.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
  585. }
  586. Shortcut {
  587. sequence: "Ctrl+5"
  588. onActivated: myClass.set_sendDate(myClass.get_pageIndex(), mainScreen.shortcut_CtrlText5.text, mainScreen.txSuffixCombo.currentIndex, mainScreen.txCode_btn.text)
  589. }
  590. Shortcut {
  591. sequence: "Ctrl+="
  592. onActivated: mainScreen.recDataEdit.font.pixelSize++
  593. }
  594. Shortcut {
  595. sequence: "Ctrl+-"
  596. onActivated: mainScreen.recDataEdit.font.pixelSize--
  597. }
  598. /*********************************************详情显示 hover**************************************************/
  599. shortcut_titleTextMouse.onEntered: {
  600. hoverDescriptionText.text = "切换编码:Ctrl+Q\n清除内容:Ctrl+W\n单次发送:Ctrl+E\n自动发送:Ctrl+R\n输入内容:Ctrl+序号\n输入内容:Alt+序号"
  601. hoverDescriptionPage.x = myMouseArea.mouseX - hoverDescriptionText.width
  602. hoverDescriptionPage.y = myMouseArea.mouseY
  603. hoverDescriptionPage.visible = true
  604. }
  605. shortcut_titleTextMouse.onExited: {
  606. hoverDescriptionPage.visible = false
  607. }
  608. rxClearBtn.onHoveredChanged: {
  609. if(rxClearBtn.hovered)
  610. {
  611. hoverDescriptionText.text = "清零接收字节计数"
  612. hoverDescriptionPage.x = myMouseArea.mouseX
  613. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  614. hoverDescriptionPage.visible = true
  615. }
  616. else
  617. {
  618. hoverDescriptionPage.visible = false
  619. }
  620. }
  621. txClearBtn.onHoveredChanged: {
  622. if(txClearBtn.hovered)
  623. {
  624. hoverDescriptionText.text = "清零发送字节计数"
  625. hoverDescriptionPage.x = myMouseArea.mouseX
  626. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  627. hoverDescriptionPage.visible = true
  628. }
  629. else
  630. {
  631. hoverDescriptionPage.visible = false
  632. }
  633. }
  634. rxCode_btn.onHoveredChanged: {
  635. if(rxCode_btn.hovered)
  636. {
  637. hoverDescriptionText.text = "接收编码方式"
  638. hoverDescriptionPage.x = myMouseArea.mouseX
  639. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  640. hoverDescriptionPage.visible = true
  641. }
  642. else
  643. {
  644. hoverDescriptionPage.visible = false
  645. }
  646. }
  647. rxEN_btn.onHoveredChanged: {
  648. if(rxEN_btn.hovered)
  649. {
  650. hoverDescriptionText.text = "接收显示开关, 绿色为接收数据"
  651. hoverDescriptionPage.x = myMouseArea.mouseX
  652. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  653. hoverDescriptionPage.visible = true
  654. }
  655. else
  656. {
  657. hoverDescriptionPage.visible = false
  658. }
  659. }
  660. txEN_btn.onHoveredChanged: {
  661. if(txEN_btn.hovered)
  662. {
  663. hoverDescriptionText.text = "发送回显开关, 白色为回显数据"
  664. hoverDescriptionPage.x = myMouseArea.mouseX
  665. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  666. hoverDescriptionPage.visible = true
  667. }
  668. else
  669. {
  670. hoverDescriptionPage.visible = false
  671. }
  672. }
  673. displayDate_btn.onHoveredChanged: {
  674. if(displayDate_btn.hovered)
  675. {
  676. hoverDescriptionText.text = "时间戳显示开关"
  677. hoverDescriptionPage.x = myMouseArea.mouseX
  678. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  679. hoverDescriptionPage.visible = true
  680. }
  681. else
  682. {
  683. hoverDescriptionPage.visible = false
  684. }
  685. }
  686. saveFile_btn.onHoveredChanged: {
  687. if(saveFile_btn.hovered)
  688. {
  689. hoverDescriptionText.text = "接收区保存至文件"
  690. hoverDescriptionPage.x = myMouseArea.mouseX
  691. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  692. hoverDescriptionPage.visible = true
  693. }
  694. else
  695. {
  696. hoverDescriptionPage.visible = false
  697. }
  698. }
  699. rxClear_btn.onHoveredChanged: {
  700. if(rxClear_btn.hovered)
  701. {
  702. hoverDescriptionText.text = "接收区清空"
  703. hoverDescriptionPage.x = myMouseArea.mouseX
  704. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  705. hoverDescriptionPage.visible = true
  706. }
  707. else
  708. {
  709. hoverDescriptionPage.visible = false
  710. }
  711. }
  712. slider_color.onHoveredChanged: {
  713. if(slider_color.hovered)
  714. {
  715. hoverDescriptionText.text = "背景色滑动条"
  716. hoverDescriptionPage.x = myMouseArea.mouseX
  717. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  718. hoverDescriptionPage.visible = true
  719. }
  720. else
  721. {
  722. hoverDescriptionPage.visible = false
  723. }
  724. }
  725. txCode_btn.onHoveredChanged: {
  726. if(txCode_btn.hovered)
  727. {
  728. hoverDescriptionText.text = "发送编码方式"
  729. hoverDescriptionPage.x = myMouseArea.mouseX
  730. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  731. hoverDescriptionPage.visible = true
  732. }
  733. else
  734. {
  735. hoverDescriptionPage.visible = false
  736. }
  737. }
  738. txClear_btn.onHoveredChanged: {
  739. if(txClear_btn.hovered)
  740. {
  741. hoverDescriptionText.text = "发送区清空"
  742. hoverDescriptionPage.x = myMouseArea.mouseX
  743. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  744. hoverDescriptionPage.visible = true
  745. }
  746. else
  747. {
  748. hoverDescriptionPage.visible = false
  749. }
  750. }
  751. txSend_btn.onHoveredChanged: {
  752. if(txSend_btn.hovered)
  753. {
  754. hoverDescriptionText.text = "发送数据"
  755. hoverDescriptionPage.x = myMouseArea.mouseX
  756. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  757. hoverDescriptionPage.visible = true
  758. }
  759. else
  760. {
  761. hoverDescriptionPage.visible = false
  762. }
  763. }
  764. txAutoSend_btn.onHoveredChanged: {
  765. if(txAutoSend_btn.hovered)
  766. {
  767. hoverDescriptionText.text = "自动发送开关"
  768. hoverDescriptionPage.x = myMouseArea.mouseX
  769. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  770. hoverDescriptionPage.visible = true
  771. }
  772. else
  773. {
  774. hoverDescriptionPage.visible = false
  775. }
  776. }
  777. autoSendTime.onHoveredChanged: {
  778. if(autoSendTime.hovered)
  779. {
  780. hoverDescriptionText.text = "自动发送时间/ms"
  781. hoverDescriptionPage.x = myMouseArea.mouseX
  782. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  783. hoverDescriptionPage.visible = true
  784. }
  785. else
  786. {
  787. hoverDescriptionPage.visible = false
  788. }
  789. }
  790. txSuffixCombo.onHoveredChanged: {
  791. if(txSuffixCombo.hovered)
  792. {
  793. hoverDescriptionText.text = "发送数据后缀"
  794. hoverDescriptionPage.x = myMouseArea.mouseX
  795. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  796. hoverDescriptionPage.visible = true
  797. }
  798. else
  799. {
  800. hoverDescriptionPage.visible = false
  801. }
  802. }
  803. ip_myAddrText.onHoveredChanged: {
  804. if(ip_myAddrText.hovered)
  805. {
  806. switch(ip_nameCombo.currentIndex)
  807. {
  808. case 0: hoverDescriptionText.text = "不使用, 不可编辑"; break;
  809. case 1: hoverDescriptionText.text = "可不填, 默认本地IP地址"; break;
  810. case 2: hoverDescriptionText.text = "可不填, 默认本地IP地址"; break;
  811. }
  812. hoverDescriptionPage.x = myMouseArea.mouseX
  813. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  814. hoverDescriptionPage.visible = true
  815. }
  816. else
  817. {
  818. hoverDescriptionPage.visible = false
  819. }
  820. }
  821. ip_myPortText.onHoveredChanged: {
  822. if(ip_myPortText.hovered)
  823. {
  824. switch(ip_nameCombo.currentIndex)
  825. {
  826. case 0: hoverDescriptionText.text = "不使用, 不可编辑"; break;
  827. case 1: hoverDescriptionText.text = "监听端口号即本地端口号"; break;
  828. case 2: hoverDescriptionText.text = "监听端口号即本地端口号"; break;
  829. }
  830. hoverDescriptionPage.x = myMouseArea.mouseX
  831. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  832. hoverDescriptionPage.visible = true
  833. }
  834. else
  835. {
  836. hoverDescriptionPage.visible = false
  837. }
  838. }
  839. ip_otherAddrText.onHoveredChanged: {
  840. if(ip_otherAddrText.hovered)
  841. {
  842. switch(ip_nameCombo.currentIndex)
  843. {
  844. case 0: hoverDescriptionText.text = "服务器IP地址"; break;
  845. case 1: hoverDescriptionText.text = "不使用, 不可编辑"; break;
  846. case 2: hoverDescriptionText.text = "远程IP地址"; break;
  847. case 3: hoverDescriptionText.text = "服务器地址"; break;
  848. }
  849. hoverDescriptionPage.x = myMouseArea.mouseX
  850. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  851. hoverDescriptionPage.visible = true
  852. }
  853. else
  854. {
  855. hoverDescriptionPage.visible = false
  856. }
  857. }
  858. ip_otherPortText.onHoveredChanged: {
  859. if(ip_otherPortText.hovered)
  860. {
  861. switch(ip_nameCombo.currentIndex)
  862. {
  863. case 0: hoverDescriptionText.text = "服务器端口号"; break;
  864. case 1: hoverDescriptionText.text = "不使用, 不可编辑"; break;
  865. case 2: hoverDescriptionText.text = "远程端口号"; break;
  866. case 3: hoverDescriptionText.text = "端口号"; break;
  867. }
  868. hoverDescriptionPage.x = myMouseArea.mouseX
  869. hoverDescriptionPage.y = myMouseArea.mouseY - hoverDescriptionText.height
  870. hoverDescriptionPage.visible = true
  871. }
  872. else
  873. {
  874. hoverDescriptionPage.visible = false
  875. }
  876. }
  877. // 左侧边栏鼠标悬停
  878. // frame.onHoveredChanged: {
  879. // if(frame.hovered)
  880. // {
  881. // console.log("1111");
  882. // }
  883. // else
  884. // {
  885. // console.log("2222");
  886. // }
  887. // }
  888. }
  889. }
  890. /*##^##
  891. Designer {
  892. D{i:0;formeditorZoom:0.66}
  893. }
  894. ##^##*/