DetailPage.qml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. import QtQuick
  2. import QtQuick.Controls 2.5
  3. import QtQuick.Layouts 1.3
  4. import "backend.js" as Backend
  5. Rectangle {
  6. id: detailForm
  7. width: parent.width
  8. height: parent.height
  9. color: 'transparent'
  10. property StackView stack: null
  11. property string name: ""
  12. property string uid: ""
  13. // property int statue: 0
  14. property int loadingCount: 0
  15. function refresh()
  16. {
  17. //connectButton.text="连接"
  18. if (!appModel.ready)
  19. connectButton.text="连接"
  20. else
  21. connectButton.text="断开"
  22. }
  23. function disconnect()
  24. {
  25. disconn.start()
  26. console.log("321312")
  27. }
  28. Rectangle {
  29. width: 1280
  30. height: 720
  31. anchors.horizontalCenter: parent.horizontalCenter
  32. anchors.verticalCenter: parent.verticalCenter
  33. color: 'transparent'
  34. border.color: mainAppColor
  35. border.width: 1
  36. radius: 5
  37. // Image {
  38. // id: myIcon
  39. // width: 200
  40. // height: 200
  41. // anchors.horizontalCenter: parent.horizontalCenter
  42. // anchors.verticalCenter: parent.verticalCenter
  43. // fillMode: Image.PreserveAspectFit
  44. // source: 'qrc:/images/car1.png'
  45. // }
  46. Rectangle {
  47. width: 1280
  48. height: 720
  49. color: 'transparent'
  50. anchors.top: parent.top
  51. anchors.topMargin: 50
  52. anchors.horizontalCenter: parent.horizontalCenter
  53. // anchors.verticalCenter: parent.verticalCenter
  54. // CAM Panel
  55. Image {
  56. id: panelImg
  57. visible: false
  58. width: 1280
  59. height: 720
  60. fillMode: Image.Stretch
  61. source:'qrc:/images/PanelImage.png'
  62. }
  63. }
  64. CButton {
  65. id: carButton
  66. x:10
  67. y:200
  68. textHeight: 50
  69. fontHeight: 0.4
  70. width: 50
  71. height: 200
  72. color: pressed ? textClickedColor : mainAppColor
  73. Text{
  74. text: "\n 场\n 地\n 管\n 理"
  75. wrapMode: Text.WordWrap
  76. font.pointSize: 20
  77. color:"white"
  78. // anchors.horizontalCenter: parent.horizontalCenter
  79. // horizontalAlignment: Text.AlignHCenter
  80. verticalAlignment: Text.AlignVCenter
  81. }
  82. onClicked:workManage();
  83. }
  84. /*
  85. Text {
  86. id: carName
  87. anchors {
  88. top: myIcon.bottom
  89. topMargin: 10
  90. horizontalCenter: parent.horizontalCenter
  91. }
  92. text: name
  93. color: '#eaf4fc'
  94. font.family: alibaba.name
  95. font.pointSize: 20
  96. }
  97. Text {
  98. id: carConnState
  99. anchors {
  100. top: carName.bottom
  101. topMargin: 10
  102. horizontalCenter: parent.horizontalCenter
  103. }
  104. text: !appModel.ready ? "未连接" : "已连接"
  105. color: '#eaf4fc'
  106. font.family: alibaba.name
  107. font.pointSize: 20
  108. }*/
  109. /* Image {
  110. id: model
  111. x:appModel.ModelX
  112. y:appModel.modelY
  113. width: 30
  114. height: 30
  115. fillMode: Image.Stretch
  116. source:'qrc:/images/PanelImage.png'
  117. }
  118. */
  119. Row {
  120. height: parent.height
  121. anchors.horizontalCenter: parent.horizontalCenter
  122. anchors.top: parent.bottom
  123. // anchors.top:parent.top
  124. // anchors.topMargin: 20
  125. // y:250
  126. // x:100
  127. spacing: 40
  128. CButton {
  129. id: connectButton
  130. // anchors.topMargin: 50
  131. y:10
  132. textHeight: 50
  133. fontHeight: 0.4
  134. width: 250
  135. height: 50
  136. color: pressed ? textClickedColor : mainAppColor
  137. text: appModel.ready ? "断开" : "连接"
  138. onClicked: {
  139. if (!appModel.ready) {
  140. connectButton.visible = false
  141. loading.start()
  142. carSelect(uid)
  143. backButton.visible = false
  144. appModel.ready = true
  145. connectButton.text="断开"
  146. } else {
  147. connectButton.visible = false
  148. disconn.start()
  149. appModel.leaveCar()
  150. appModel.ready = false
  151. connectButton.text="连接"
  152. // stack.pop()
  153. }
  154. }
  155. }
  156. Timer {
  157. id: loading
  158. interval: 10000
  159. onTriggered: {
  160. connectButton.visible = true
  161. //connectButton.text="连接"
  162. backButton.visible=true
  163. // loadingCount++
  164. // carConnState.text = "连接中" + Backend.dot(loadingCount)
  165. // if (loadingCount === 4)
  166. // loadingCount = 0
  167. }
  168. }
  169. Timer {
  170. id: disconn
  171. interval: 5000
  172. onTriggered: {
  173. connectButton.visible = true
  174. //connectButton.text="断开"
  175. backButton.visible = true
  176. }
  177. }
  178. CButton {
  179. id: backButton
  180. // anchors.top: connectButton.bottom
  181. // anchors.topMargin: 30
  182. // anchors.horizontalCenter: parent.horizontalCenter
  183. textHeight: 50
  184. fontHeight: 0.4
  185. width: 250
  186. height: 50
  187. y:10
  188. visible:appModel.ready?false:true
  189. color: pressed ? textClickedColor : mainAppColor
  190. text: "返回"
  191. onClicked: {
  192. connectButton.enabled = true
  193. // carConnState.text = ""
  194. stack.pop()
  195. }
  196. }
  197. }
  198. Component.onCompleted: {
  199. loading.start()
  200. }
  201. }
  202. }