MainWindow.qml 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110
  1. import QtQml 2.3
  2. import QtQuick 2.6
  3. import QtQuick.Window 2.2
  4. import QtQuick.Controls 2.0
  5. //import QtDataVisualization 1.2
  6. //import QtQuick3D
  7. Item {
  8. id: mainWindow
  9. visible: true
  10. width: 3840
  11. height: 1080
  12. // signal imageEvent(string params)
  13. // onImageEvent: {
  14. // if (params === "redrawImage") {
  15. // cam_front_rear.signalRedraw()
  16. // }
  17. // }
  18. // property int mainHeight: 1000
  19. // property int lineWidth: 20
  20. // property int statusWidth: 467
  21. // property int leftCamWidth: 540
  22. // property int frontCamWidth: 1706
  23. // property int rightCamWidth: 540
  24. // property int radarWidth: 467
  25. // property int radarSize: 120
  26. property int mainHeight: 1000
  27. property int lineWidth: 20
  28. property int statusWidth: 417
  29. property int leftCamWidth: 490
  30. property int frontCamWidth: 1906
  31. property int rightCamWidth: 490
  32. property int radarWidth: 417
  33. property int radarSize: 120
  34. // property int topCamHeight: 500
  35. // property int bottomCamHeight: 500
  36. property int radarRedRange: 2000
  37. property int radarGreenRange: 4000
  38. property string radarRightFGreenImg: 'qrc:/images/right_f_green.png'
  39. property string radarRightFYellowImg: 'qrc:/images/right_f_yellow.png'
  40. property string radarRightFRedImg: 'qrc:/images/right_f_red.png'
  41. property string radarRightRGreenImg: 'qrc:/images/right_r_green.png'
  42. property string radarRightRYellowImg: 'qrc:/images/right_r_yellow.png'
  43. property string radarRightRRedImg: 'qrc:/images/right_r_red.png'
  44. property string radarLeftFGreenImg: 'qrc:/images/left_f_green.png'
  45. property string radarLeftFYellowImg: 'qrc:/images/left_f_yellow.png'
  46. property string radarLeftFRedImg: 'qrc:/images/left_f_red.png'
  47. property string radarLeftRGreenImg: 'qrc:/images/left_r_green.png'
  48. property string radarLeftRYellowImg: 'qrc:/images/left_r_yellow.png'
  49. property string radarLeftRRedImg: 'qrc:/images/left_r_red.png'
  50. property string radarBottomGreenImg: 'qrc:/images/bottom_green.png'
  51. property string radarBottomYellowImg: 'qrc:/images/bottom_yellow.png'
  52. property string radarBottomRedImg: 'qrc:/images/bottom_red.png'
  53. property int radarRightMargin: 40
  54. property int radarTopMargin: 350
  55. property int radarBottomMargin: 280
  56. property int radarleftMargin: 200
  57. property int radarTxtSize: 18
  58. FontLoader {
  59. id: alibaba
  60. source: "qrc:/components/font/Alibaba-PuHuiTi-Bold.ttf"
  61. }
  62. FontLoader {
  63. id: fontawesome
  64. source: "qrc:/components/font/fontawesome-webfont.ttf"
  65. }
  66. Rectangle {
  67. id: mainForm
  68. anchors.fill: parent
  69. Image {
  70. fillMode: Image.PreserveAspectFit
  71. source: 'qrc:/images/bg4k.png'
  72. }
  73. Rectangle {
  74. id: mainFormHeader
  75. width: mainForm.width
  76. height: 80
  77. color: 'transparent'
  78. Image {
  79. id: mainFormBannerBg
  80. anchors.top: mainFormHeader.top
  81. anchors.horizontalCenter: mainFormHeader.horizontalCenter
  82. fillMode: Image.PreserveAspectFit
  83. source: 'qrc:/images/banner.png'
  84. }
  85. Text {
  86. id: mainFormTitle
  87. width: mainFormHeader.width
  88. height: mainFormHeader.height
  89. horizontalAlignment: Text.AlignHCenter
  90. verticalAlignment: Text.AlignVCenter
  91. text: textTitle
  92. font.family: alibaba.name
  93. font.pointSize: 24
  94. color: mainTextColor
  95. }
  96. Text {
  97. id: delayms
  98. text: '网络延迟: ' + (appModel.ping / 2).toFixed(1) + ' ms'
  99. color: appModel.ping > 200 ? popupBgColorErr : mainTextColor
  100. font.family: alibaba.name
  101. font.pointSize: 12
  102. anchors.right: mainFormHeader.right
  103. anchors.rightMargin: 50
  104. anchors.top: mainFormHeader.top
  105. anchors.topMargin: 50
  106. }
  107. }
  108. Rectangle {
  109. id: mainFormContent
  110. width: mainForm.width
  111. height: mainForm.height - 80
  112. anchors.top: mainFormHeader.bottom
  113. color: 'transparent'
  114. Row {
  115. Rectangle {
  116. id: statusData
  117. width: statusWidth + lineWidth
  118. height: mainHeight
  119. color: 'transparent'
  120. Image {
  121. width: lineWidth
  122. height: mainHeight
  123. anchors.left: statusData.left
  124. anchors.leftMargin: 20
  125. fillMode: Image.Stretch
  126. source: 'qrc:/images/border_l.png'
  127. }
  128. Column {
  129. id: carDataForm
  130. width: statusData.width - 60
  131. height: 300
  132. anchors.top: statusData.top
  133. anchors.topMargin: 20
  134. anchors.horizontalCenter: statusData.horizontalCenter
  135. Text {
  136. id: posText
  137. text: "车辆姿态:"
  138. color: mainTextColor
  139. anchors.left: statusData.left
  140. anchors.leftMargin: 20
  141. font.family: alibaba.name
  142. font.pointSize: 20
  143. anchors.horizontalCenter: statusData.horizontalCenter
  144. }
  145. Image {
  146. id: posSideView
  147. anchors.top: posText.bottom
  148. anchors.topMargin: 50
  149. width: 360
  150. height: 240
  151. fillMode: Image.Stretch
  152. source: 'qrc:/images/side_view.png'
  153. anchors.horizontalCenter: statusData.horizontalCenter
  154. //transformOrigin: Item.Center
  155. Component.onCompleted: {
  156. posSideTimer.start()
  157. }
  158. }
  159. RotationAnimation {
  160. id: posSideAnim
  161. target: posSideView
  162. from: 0
  163. to: 0
  164. duration: 100
  165. }
  166. Timer {
  167. id: posSideTimer
  168. interval: 2000
  169. repeat: true
  170. onTriggered: {
  171. posSideAnim.from = 0
  172. posSideAnim.to = appModel.imux
  173. posSideAnim.start()
  174. }
  175. }
  176. Row {
  177. anchors.top: posSideView.bottom
  178. anchors.topMargin: 20
  179. Text {
  180. id: xAngle
  181. text: "横向倾角(度):"
  182. color: mainTextColor
  183. anchors.left: statusData.left
  184. anchors.leftMargin: 20
  185. font.family: alibaba.name
  186. font.pointSize: 20
  187. anchors.horizontalCenter: statusData.horizontalCenter
  188. }
  189. spacing: 50
  190. Text {
  191. id: xAngleValue
  192. text: appModel.imux
  193. color: appModel.imux >= 30 ? 'red' : '#FFFFFF'
  194. font.family: digtalFont.name
  195. font.pointSize: 36
  196. }
  197. }
  198. Image {
  199. id: posRearView
  200. anchors.top: posSideView.bottom
  201. anchors.topMargin: 80
  202. width: 360
  203. height: 240
  204. fillMode: Image.Stretch
  205. source: 'qrc:/images/rear_view.png'
  206. anchors.horizontalCenter: statusData.horizontalCenter
  207. Component.onCompleted: {
  208. posRearTimer.start()
  209. }
  210. }
  211. RotationAnimation {
  212. id: posRearAnim
  213. target: posRearView
  214. from: 0
  215. to: 0
  216. duration: 100
  217. }
  218. Timer {
  219. id: posRearTimer
  220. interval: 2000
  221. repeat: true
  222. onTriggered: {
  223. posRearAnim.from = 0
  224. posRearAnim.to = appModel.imuy
  225. posRearAnim.start()
  226. }
  227. }
  228. Row {
  229. anchors.top: posRearView.bottom
  230. anchors.topMargin: 20
  231. Text {
  232. id: yAngle
  233. text: "纵向倾角(度):"
  234. color: mainTextColor
  235. anchors.left: statusData.left
  236. anchors.leftMargin: 20
  237. font.family: alibaba.name
  238. font.pointSize: 20
  239. anchors.horizontalCenter: statusData.horizontalCenter
  240. }
  241. spacing: 50
  242. Text {
  243. id: yAngleValue
  244. text: appModel.imuy
  245. color: appModel.imuy >= 30 ? 'red' : '#FFFFFF'
  246. font.family: digtalFont.name
  247. font.pointSize: 36
  248. }
  249. }
  250. }
  251. Rectangle {
  252. id: refreshDate
  253. width: statusData.width - 60
  254. height: 50
  255. color: mainAppColor
  256. anchors.bottom: statusData.bottom
  257. anchors.bottomMargin: 30
  258. anchors.horizontalCenter: statusData.horizontalCenter
  259. anchors.horizontalCenterOffset: 10
  260. Text {
  261. id: localTime
  262. width: 140
  263. height: 50
  264. anchors.horizontalCenter: refreshDate.horizontalCenter
  265. color: '#FFFFFF'
  266. font.family: digtalFont.name
  267. font.pointSize: 36
  268. text: new Date().toLocaleTimeString()
  269. Component.onCompleted: {
  270. localTimeRefresh.start()
  271. }
  272. }
  273. Timer {
  274. id: localTimeRefresh
  275. interval: 1000
  276. repeat: true
  277. onTriggered: {
  278. localTime.text = new Date().toLocaleTimeString()
  279. }
  280. }
  281. }
  282. Image {
  283. width: lineWidth
  284. height: mainHeight
  285. anchors.right: statusData.right
  286. fillMode: Image.Stretch
  287. source: 'qrc:/images/border_r.png'
  288. }
  289. }
  290. Rectangle {
  291. id: leftCam
  292. width: leftCamWidth + lineWidth
  293. height: mainHeight
  294. color: 'transparent'
  295. Image {
  296. width: lineWidth
  297. height: mainHeight
  298. anchors.left: leftCam.left
  299. anchors.leftMargin: 20
  300. fillMode: Image.Stretch
  301. source: 'qrc:/images/border_l.png'
  302. z: 99
  303. }
  304. Column {
  305. anchors.left: leftCam.left
  306. anchors.leftMargin: 20
  307. // // CAM ForwardRight
  308. // Rectangle {
  309. // width: rightCamWidth
  310. // height: topCamHeight
  311. // color: 'transparent'
  312. // Image {
  313. // id: forwardRightImg
  314. // width: leftCamWidth
  315. // height: bottomCamHeight
  316. // //fillMode: Image.Stretch
  317. // fillMode: Image.PreserveAspectCrop
  318. // }
  319. // Connections {
  320. // target: ForwardRightImage
  321. // onCallQmlRefeshForwardRightImg: {
  322. // forwardRightImg.source = ""
  323. // forwardRightImg.source = "image://ForwardRightImage"
  324. // }
  325. // }
  326. // }
  327. Rectangle {
  328. width: leftCamWidth
  329. height: mainHeight
  330. color: 'transparent'
  331. anchors.left: leftCam.left
  332. anchors.leftMargin: 20
  333. // CAM Left
  334. Image {
  335. id: leftImg
  336. width: leftCamWidth
  337. height: mainHeight
  338. fillMode: Image.Stretch
  339. }
  340. Connections {
  341. target: LeftImage
  342. onCallQmlRefeshLeftImg: {
  343. leftImg.source = ""
  344. leftImg.source = "image://LeftImage"
  345. }
  346. }
  347. }
  348. }
  349. Image {
  350. width: lineWidth
  351. height: mainHeight
  352. anchors.right: leftCam.right
  353. fillMode: Image.Stretch
  354. source: 'qrc:/images/border_r.png'
  355. z: 99
  356. }
  357. }
  358. Rectangle {
  359. id: centerPanel
  360. width: frontCamWidth + 2 * lineWidth
  361. height: mainHeight
  362. anchors.top: mainFormContent.top
  363. anchors.horizontalCenter: mainFormContent.horizontalCenter
  364. color: 'transparent'
  365. MouseArea {
  366. anchors.fill: parent
  367. drag.target: backImgRect
  368. drag.axis: Drag.XandYAxis
  369. drag.minimumX: 20
  370. drag.maximumX: centerPanel.width - backImgRect.width - 20
  371. drag.minimumY: 0
  372. drag.maximumY: centerPanel.height - backImgRect.height
  373. }
  374. Image {
  375. width: lineWidth
  376. height: mainHeight
  377. anchors.left: centerPanel.left
  378. anchors.leftMargin: 20
  379. fillMode: Image.Stretch
  380. source: 'qrc:/images/border_l.png'
  381. z: 99
  382. }
  383. Rectangle {
  384. width: frontCamWidth
  385. height: mainHeight
  386. color: 'transparent'
  387. anchors.left: centerPanel.left
  388. anchors.leftMargin: 20
  389. // CAM FRONT
  390. Image {
  391. id: img
  392. anchors.topMargin: 140
  393. width: frontCamWidth
  394. height: mainHeight
  395. fillMode: Image.Stretch
  396. z: 97
  397. }
  398. Connections {
  399. target: FrontImage
  400. onCallQmlRefeshImg: {
  401. img.source = ""
  402. img.source = "image://FrontImage"
  403. }
  404. }
  405. }
  406. Rectangle {
  407. id: backImgRect
  408. width: frontCamWidth / 3
  409. height: mainHeight / 3
  410. color: 'transparent'
  411. x: 25
  412. border.color: mainAppColor
  413. border.width: 1
  414. Image {
  415. id: cautionLine
  416. anchors.horizontalCenter: parent.horizontalCenter
  417. width: parent.width / 1.5
  418. height: parent.height / 3
  419. fillMode: Image.Stretch
  420. z: 99
  421. y: 220
  422. source: 'qrc:/images/caution.png'
  423. }
  424. // CAM BACK REAR
  425. Image {
  426. id: backImg
  427. anchors.topMargin: 140
  428. width: parent.width
  429. height: parent.height
  430. fillMode: Image.Stretch
  431. z: 98
  432. }
  433. Connections {
  434. target: BackImage
  435. onCallQmlRefeshBackImg: {
  436. backImg.source = ""
  437. backImg.source = "image://BackImage"
  438. }
  439. }
  440. }
  441. Image {
  442. width: lineWidth
  443. height: mainHeight
  444. anchors.right: centerPanel.right
  445. anchors.rightMargin: 20
  446. fillMode: Image.Stretch
  447. source: 'qrc:/images/border_r.png'
  448. z: 99
  449. }
  450. }
  451. Rectangle {
  452. id: rightCam
  453. width: rightCamWidth + lineWidth
  454. height: mainHeight
  455. color: 'transparent'
  456. Image {
  457. width: lineWidth
  458. height: mainHeight
  459. anchors.left: rightCam.left
  460. fillMode: Image.Stretch
  461. source: 'qrc:/images/border_l.png'
  462. z: 99
  463. }
  464. Column {
  465. anchors.right: rightCam.right
  466. anchors.rightMargin: 20
  467. // // CAM ForwardRight
  468. // Rectangle {
  469. // width: rightCamWidth
  470. // height: topCamHeight
  471. // color: 'transparent'
  472. // Image {
  473. // id: forwardRightImg
  474. // width: leftCamWidth
  475. // height: bottomCamHeight
  476. // //fillMode: Image.Stretch
  477. // fillMode: Image.PreserveAspectCrop
  478. // }
  479. // Connections {
  480. // target: ForwardRightImage
  481. // onCallQmlRefeshForwardRightImg: {
  482. // forwardRightImg.source = ""
  483. // forwardRightImg.source = "image://ForwardRightImage"
  484. // }
  485. // }
  486. // }
  487. Rectangle {
  488. width: rightCamWidth
  489. height: mainHeight
  490. color: 'transparent'
  491. anchors.left: rightCam.left
  492. // CAM Right
  493. Image {
  494. id: rightImg
  495. width: rightCamWidth
  496. height: mainHeight
  497. fillMode: Image.Stretch
  498. }
  499. Connections {
  500. target: RightImage
  501. onCallQmlRefeshRightImg: {
  502. rightImg.source = ""
  503. rightImg.source = "image://RightImage"
  504. }
  505. }
  506. }
  507. }
  508. Image {
  509. width: lineWidth
  510. height: mainHeight
  511. anchors.right: rightCam.right
  512. anchors.rightMargin: 20
  513. fillMode: Image.Stretch
  514. source: 'qrc:/images/border_r.png'
  515. z: 99
  516. }
  517. }
  518. Rectangle {
  519. id: radarData
  520. width: radarWidth
  521. height: mainHeight
  522. color: 'transparent'
  523. Image {
  524. width: lineWidth
  525. height: mainHeight
  526. anchors.left: radarData.left
  527. fillMode: Image.Stretch
  528. source: 'qrc:/images/border_l.png'
  529. }
  530. Image {
  531. id: radar_car
  532. width: 600
  533. height: 800
  534. anchors.horizontalCenter: radarData.horizontalCenter
  535. anchors.verticalCenter: radarData.verticalCenter
  536. fillMode: Image.Stretch
  537. source: 'qrc:/images/radar_car.png'
  538. }
  539. //------------ radarRightF
  540. Image {
  541. id: radarRightF0
  542. width: radarSize
  543. height: radarSize
  544. anchors.right: radarData.right
  545. anchors.rightMargin: radarRightMargin
  546. anchors.top: radarData.top
  547. anchors.topMargin: radarTopMargin
  548. fillMode: Image.PreserveAspectFit
  549. source: radarRightFGreenImg
  550. visible: appModel.radar1 >= radarGreenRange
  551. }
  552. Image {
  553. id: radarRightF1
  554. width: radarSize
  555. height: radarSize
  556. anchors.right: radarData.right
  557. anchors.rightMargin: radarRightMargin
  558. anchors.top: radarData.top
  559. anchors.topMargin: radarTopMargin
  560. fillMode: Image.PreserveAspectFit
  561. source: radarRightFYellowImg
  562. visible: appModel.radar1 < radarGreenRange
  563. && appModel.radar1 > radarRedRange
  564. }
  565. Image {
  566. id: radarRightF2
  567. width: radarSize
  568. height: radarSize
  569. anchors.right: radarData.right
  570. anchors.rightMargin: radarRightMargin
  571. anchors.top: radarData.top
  572. anchors.topMargin: radarTopMargin
  573. fillMode: Image.PreserveAspectFit
  574. source: radarRightFRedImg
  575. visible: appModel.radar1 <= radarRedRange
  576. }
  577. //------------ radarRightR
  578. Image {
  579. id: radarRightR0
  580. width: radarSize
  581. height: radarSize
  582. anchors.bottom: radarData.bottom
  583. anchors.bottomMargin: radarTopMargin
  584. anchors.right: radarData.right
  585. anchors.rightMargin: radarRightMargin
  586. fillMode: Image.PreserveAspectFit
  587. source: radarRightRGreenImg
  588. visible: appModel.radar2 >= radarGreenRange
  589. }
  590. Image {
  591. id: radarRightR1
  592. width: radarSize
  593. height: radarSize
  594. anchors.bottom: radarData.bottom
  595. anchors.bottomMargin: radarTopMargin
  596. anchors.right: radarData.right
  597. anchors.rightMargin: radarRightMargin
  598. fillMode: Image.PreserveAspectFit
  599. source: radarRightRYellowImg
  600. visible: appModel.radar2 < radarGreenRange
  601. && appModel.radar2 > radarRedRange
  602. }
  603. Image {
  604. id: radarRightR2
  605. width: radarSize
  606. height: radarSize
  607. anchors.bottom: radarData.bottom
  608. anchors.bottomMargin: radarTopMargin
  609. anchors.right: radarData.right
  610. anchors.rightMargin: radarRightMargin
  611. fillMode: Image.PreserveAspectFit
  612. source: radarRightRRedImg
  613. visible: appModel.radar2 <= radarRedRange
  614. }
  615. //------------ radarLeftF
  616. Image {
  617. id: radarLeftF0
  618. width: radarSize
  619. height: radarSize
  620. anchors.left: radarData.left
  621. anchors.leftMargin: radarRightMargin
  622. anchors.top: radarData.top
  623. anchors.topMargin: radarTopMargin
  624. fillMode: Image.PreserveAspectFit
  625. source: radarLeftFGreenImg
  626. visible: appModel.radar3 >= radarGreenRange
  627. }
  628. Image {
  629. id: radarLeftF1
  630. width: radarSize
  631. height: radarSize
  632. anchors.left: radarData.left
  633. anchors.leftMargin: radarRightMargin
  634. anchors.top: radarData.top
  635. anchors.topMargin: radarTopMargin
  636. fillMode: Image.PreserveAspectFit
  637. source: radarLeftFYellowImg
  638. visible: appModel.radar3 < radarGreenRange
  639. && appModel.radar3 > radarRedRange
  640. }
  641. Image {
  642. id: radarLeftF2
  643. width: radarSize
  644. height: radarSize
  645. anchors.left: radarData.left
  646. anchors.leftMargin: radarRightMargin
  647. anchors.top: radarData.top
  648. anchors.topMargin: radarTopMargin
  649. fillMode: Image.PreserveAspectFit
  650. source: radarLeftFRedImg
  651. visible: appModel.radar3 <= radarRedRange
  652. }
  653. //------------ radarLeftR
  654. Image {
  655. id: radarLeftR0
  656. width: radarSize
  657. height: radarSize
  658. anchors.bottom: radarData.bottom
  659. anchors.bottomMargin: radarTopMargin
  660. anchors.left: radarData.left
  661. anchors.leftMargin: radarRightMargin
  662. fillMode: Image.PreserveAspectFit
  663. source: radarLeftRGreenImg
  664. visible: appModel.radar4 >= radarGreenRange
  665. }
  666. Image {
  667. id: radarLeftR1
  668. width: radarSize
  669. height: radarSize
  670. anchors.bottom: radarData.bottom
  671. anchors.bottomMargin: radarTopMargin
  672. anchors.left: radarData.left
  673. anchors.leftMargin: radarRightMargin
  674. fillMode: Image.PreserveAspectFit
  675. source: radarLeftRYellowImg
  676. visible: appModel.radar4 < radarGreenRange
  677. && appModel.radar4 > radarRedRange
  678. }
  679. Image {
  680. id: radarLeftR2
  681. width: radarSize
  682. height: radarSize
  683. anchors.bottom: radarData.bottom
  684. anchors.bottomMargin: radarTopMargin
  685. anchors.left: radarData.left
  686. anchors.leftMargin: radarRightMargin
  687. fillMode: Image.PreserveAspectFit
  688. source: radarLeftRRedImg
  689. visible: appModel.radar4 <= radarRedRange
  690. }
  691. //------------ radarBottomL
  692. Image {
  693. id: radarBottomL0
  694. width: radarSize
  695. height: radarSize
  696. anchors.bottom: radarData.bottom
  697. anchors.bottomMargin: radarBottomMargin
  698. anchors.left: radarData.left
  699. anchors.leftMargin: radarleftMargin
  700. fillMode: Image.PreserveAspectFit
  701. source: radarBottomGreenImg
  702. visible: appModel.radar5 >= radarGreenRange
  703. }
  704. Image {
  705. id: radarBottomL1
  706. width: radarSize
  707. height: radarSize
  708. anchors.bottom: radarData.bottom
  709. anchors.bottomMargin: radarBottomMargin
  710. anchors.left: radarData.left
  711. anchors.leftMargin: radarleftMargin
  712. fillMode: Image.PreserveAspectFit
  713. source: radarBottomYellowImg
  714. visible: appModel.radar5 < radarGreenRange
  715. && appModel.radar5 > radarRedRange
  716. }
  717. Image {
  718. id: radarBottomL2
  719. width: radarSize
  720. height: radarSize
  721. anchors.bottom: radarData.bottom
  722. anchors.bottomMargin: radarBottomMargin
  723. anchors.left: radarData.left
  724. anchors.leftMargin: radarleftMargin
  725. fillMode: Image.PreserveAspectFit
  726. source: radarBottomRedImg
  727. visible: appModel.radar5 <= radarRedRange
  728. }
  729. //------------ radarBottomR
  730. Image {
  731. id: radarBottomR0
  732. width: radarSize
  733. height: radarSize
  734. anchors.bottom: radarData.bottom
  735. anchors.bottomMargin: radarBottomMargin
  736. anchors.right: radarData.right
  737. anchors.rightMargin: radarleftMargin
  738. fillMode: Image.PreserveAspectFit
  739. source: radarBottomGreenImg
  740. visible: appModel.radar6 >= radarGreenRange
  741. }
  742. Image {
  743. id: radarBottomR1
  744. width: radarSize
  745. height: radarSize
  746. anchors.bottom: radarData.bottom
  747. anchors.bottomMargin: radarBottomMargin
  748. anchors.right: radarData.right
  749. anchors.rightMargin: radarleftMargin
  750. fillMode: Image.PreserveAspectFit
  751. source: radarBottomYellowImg
  752. visible: appModel.radar6 < radarGreenRange
  753. && appModel.radar6 > radarRedRange
  754. }
  755. Image {
  756. id: radarBottomR2
  757. width: radarSize
  758. height: radarSize
  759. anchors.bottom: radarData.bottom
  760. anchors.bottomMargin: radarBottomMargin
  761. anchors.right: radarData.right
  762. anchors.rightMargin: radarleftMargin
  763. fillMode: Image.PreserveAspectFit
  764. source: radarBottomRedImg
  765. visible: appModel.radar6 <= radarRedRange
  766. }
  767. // Image {
  768. // id: radarBottomL
  769. // width: radarSize
  770. // height: radarSize
  771. // anchors.bottom: radarData.bottom
  772. // anchors.bottomMargin: 240
  773. // anchors.left: radarData.left
  774. // anchors.leftMargin: 200
  775. // fillMode: Image.Stretch
  776. // }
  777. // Connections {
  778. // target: RadarImage
  779. // onCallQmlRefeshRadar2: {
  780. // radarBottomL.source = "image://RadarImage/" + Math.random()
  781. // }
  782. // }
  783. // Image {
  784. // id: radarBottomR
  785. // width: radarSize
  786. // height: radarSize
  787. // anchors.bottom: radarData.bottom
  788. // anchors.bottomMargin: 240
  789. // anchors.right: radarData.right
  790. // anchors.rightMargin: 200
  791. // fillMode: Image.Stretch
  792. // }
  793. // Connections {
  794. // target: RadarImage
  795. // onCallQmlRefeshRadar1: {
  796. // radarBottomR.source = "image://RadarImage/" + Math.random()
  797. // }
  798. // }
  799. Row {
  800. height: parent.height
  801. anchors.horizontalCenter: parent.horizontalCenter
  802. anchors.top: radarData.top
  803. anchors.topMargin: 20
  804. Text {
  805. text: "雷达1:"
  806. color: mainTextColor
  807. anchors.left: radarData.left
  808. anchors.leftMargin: 20
  809. font.family: alibaba.name
  810. font.pointSize: radarTxtSize
  811. }
  812. Text {
  813. id: radar1
  814. text: (appModel.radar1 / 1000).toFixed(2)
  815. color: mainTextColor
  816. anchors.left: radarData.left
  817. anchors.leftMargin: 20
  818. font.family: alibaba.name
  819. font.pointSize: radarTxtSize
  820. }
  821. spacing: 30
  822. Text {
  823. text: "雷达2:"
  824. color: mainTextColor
  825. anchors.left: radarData.left
  826. anchors.leftMargin: 20
  827. font.family: alibaba.name
  828. font.pointSize: radarTxtSize
  829. }
  830. Text {
  831. id: radar2
  832. text: (appModel.radar2 / 1000).toFixed(2)
  833. color: mainTextColor
  834. anchors.left: radarData.left
  835. anchors.leftMargin: 60
  836. font.family: alibaba.name
  837. font.pointSize: radarTxtSize
  838. }
  839. }
  840. Row {
  841. height: parent.height
  842. anchors.top: radarData.top
  843. anchors.topMargin: 80
  844. anchors.horizontalCenter: parent.horizontalCenter
  845. Text {
  846. text: "雷达3:"
  847. color: mainTextColor
  848. anchors.left: radarData.left
  849. anchors.leftMargin: 20
  850. font.family: alibaba.name
  851. font.pointSize: radarTxtSize
  852. }
  853. Text {
  854. id: radar3
  855. text: (appModel.radar3 / 1000).toFixed(2)
  856. color: mainTextColor
  857. anchors.left: radarData.left
  858. anchors.leftMargin: 100
  859. font.family: alibaba.name
  860. font.pointSize: radarTxtSize
  861. }
  862. spacing: 30
  863. Text {
  864. text: "雷达4:"
  865. color: mainTextColor
  866. anchors.left: radarData.left
  867. anchors.leftMargin: 20
  868. font.family: alibaba.name
  869. font.pointSize: radarTxtSize
  870. }
  871. Text {
  872. id: radar4
  873. text: (appModel.radar4 / 1000).toFixed(2)
  874. color: mainTextColor
  875. anchors.left: radarData.left
  876. anchors.leftMargin: 140
  877. font.family: alibaba.name
  878. font.pointSize: radarTxtSize
  879. }
  880. }
  881. Row {
  882. height: parent.height
  883. anchors.horizontalCenter: parent.horizontalCenter
  884. anchors.top: radarData.top
  885. anchors.topMargin: 140
  886. Text {
  887. text: "雷达5:"
  888. color: mainTextColor
  889. anchors.left: radarData.left
  890. anchors.leftMargin: 20
  891. font.family: alibaba.name
  892. font.pointSize: radarTxtSize
  893. }
  894. Text {
  895. id: radar5
  896. text: (appModel.radar5 / 1000).toFixed(2)
  897. color: mainTextColor
  898. anchors.left: radarData.left
  899. anchors.leftMargin: 180
  900. font.family: alibaba.name
  901. font.pointSize: radarTxtSize
  902. }
  903. spacing: 30
  904. Text {
  905. text: "雷达6:"
  906. color: mainTextColor
  907. anchors.left: radarData.left
  908. anchors.leftMargin: 20
  909. font.family: alibaba.name
  910. font.pointSize: radarTxtSize
  911. }
  912. Text {
  913. id: radar6
  914. text: (appModel.radar6 / 1000).toFixed(2)
  915. color: mainTextColor
  916. anchors.left: radarData.left
  917. anchors.leftMargin: 220
  918. font.family: alibaba.name
  919. font.pointSize: radarTxtSize
  920. }
  921. }
  922. Rectangle {
  923. id: warning
  924. width: radarData.width - 60
  925. height: 50
  926. color: popupBgColorErr
  927. anchors.bottom: radarData.bottom
  928. anchors.bottomMargin: 30
  929. anchors.horizontalCenter: radarData.horizontalCenter
  930. Text {
  931. id: warningtxt
  932. text: qsTr("注意保持车距")
  933. color: '#FFFFFF'
  934. font.family: alibaba.name
  935. font.pointSize: 24
  936. anchors.horizontalCenter: warning.horizontalCenter
  937. }
  938. visible: appModel.radar1 < radarRedRange
  939. || appModel.radar2 < radarRedRange
  940. || appModel.radar3 < radarRedRange
  941. || appModel.radar4 < radarRedRange
  942. || appModel.radar5 < radarRedRange
  943. || appModel.radar6 < radarRedRange
  944. // AudioEngine {
  945. // id: audioengine
  946. // AudioSample {
  947. // name: "beep1"
  948. // source: "qrc:/sound/beep-1.wav"
  949. // }
  950. // Sound {
  951. // name: "explosion"
  952. // playType: Sound.Random
  953. // PlayVariation {
  954. // sample: "explosion01"
  955. // minPitch: 0.8
  956. // maxPitch: 1.1
  957. // }
  958. // PlayVariation {
  959. // sample: "explosion02"
  960. // minGain: 1.1
  961. // maxGain: 1.5
  962. // }
  963. // }
  964. // }
  965. // SoundEffect {
  966. // id: clickSound
  967. // source: "clickSound.wav"
  968. // loops: SoundEffect.Infinite
  969. // }
  970. // MouseArea {
  971. // id: playArea
  972. // anchors.fill: parent
  973. // onPressed: {
  974. // clickSound.play()
  975. // }
  976. // }
  977. // Audio {
  978. // id: audioPlayer
  979. // source: "qrc:/sound/beep-1.wav"
  980. // }
  981. // MouseArea {
  982. // id: playArea
  983. // anchors.fill: parent
  984. // onPressed: {
  985. // audioPlayer.play()
  986. // }
  987. // }
  988. }
  989. // Rectangle {
  990. // width: radarData.width
  991. // height: rightPanel.height
  992. // color: 'transparent'
  993. // Rectangle {
  994. // width: radarData.width - 300
  995. // height: radarData.height
  996. // color: 'lightblue'
  997. // Image {
  998. // width: 800
  999. // height: 1200
  1000. // anchors.left: radarData.left
  1001. // fillMode: Image.Stretch
  1002. // source: 'qrc:/images/radar_car.png'
  1003. // }
  1004. // }
  1005. // }
  1006. Image {
  1007. width: lineWidth
  1008. height: mainHeight
  1009. anchors.right: radarData.right
  1010. fillMode: Image.Stretch
  1011. source: 'qrc:/images/border_r.png'
  1012. }
  1013. }
  1014. }
  1015. }
  1016. }
  1017. }