DetailPage.qml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. if (!appModel.ready)
  18. connectButton.text="连接"
  19. else
  20. connectButton.text="断开"
  21. }
  22. function disconnect()
  23. {
  24. disconn.start()
  25. console.log("321312")
  26. }
  27. Rectangle {
  28. width: 1280
  29. height: 720
  30. anchors.horizontalCenter: parent.horizontalCenter
  31. anchors.verticalCenter: parent.verticalCenter
  32. color: 'transparent'
  33. border.color: mainAppColor
  34. border.width: 1
  35. radius: 5
  36. Rectangle {
  37. width: 1280
  38. height: 720
  39. color: 'transparent'
  40. anchors.top: parent.top
  41. anchors.topMargin: 0
  42. anchors.horizontalCenter: parent.horizontalCenter
  43. //visible:false
  44. visible:true
  45. // CAM BackImg
  46. //aaa
  47. Image {
  48. id: backImg
  49. visible: true
  50. width: 1280
  51. height: 720
  52. fillMode: Image.Stretch
  53. }
  54. Connections {
  55. target: BackImage
  56. onCallQmlRefeshBackImg: {
  57. backImg.source = ""
  58. backImg.source = "image://BackImage"
  59. }
  60. }
  61. }
  62. CButton {
  63. id: carButton
  64. x:10
  65. y:200
  66. textHeight: 50
  67. fontHeight: 0.4
  68. width: 50
  69. height: 200
  70. visible:false
  71. color: pressed ? textClickedColor : mainAppColor
  72. Text{
  73. text: "\n 场\n 地\n 管\n 理"
  74. wrapMode: Text.WordWrap
  75. font.pointSize: 20
  76. color:"white"
  77. verticalAlignment: Text.AlignVCenter
  78. }
  79. onClicked:workManage();
  80. }
  81. Row {
  82. height: parent.height
  83. anchors.horizontalCenter: parent.horizontalCenter
  84. anchors.top: parent.bottom
  85. spacing: 40
  86. CButton {
  87. id: connectButton
  88. //anchors.topMargin: 50
  89. y:10
  90. textHeight: 50
  91. fontHeight: 0.4
  92. width: 250
  93. height: 50
  94. color: pressed ? textClickedColor : mainAppColor
  95. text: appModel.ready ? "断开" : "连接"
  96. onClicked: {
  97. if (!appModel.ready) {
  98. connectButton.visible = false
  99. loading.start()
  100. carSelect(uid)
  101. backButton.visible = false
  102. appModel.ready = true
  103. connectButton.text="断开"
  104. } else {
  105. connectButton.visible = false
  106. disconn.start()
  107. appModel.leaveCar()
  108. appModel.ready = false
  109. connectButton.text="连接"
  110. //stack.pop()
  111. }
  112. }
  113. }
  114. Timer {
  115. id: loading
  116. interval: 500
  117. onTriggered: {
  118. connectButton.visible = true
  119. //connectButton.text="连接"
  120. backButton.visible=true
  121. }
  122. }
  123. Timer {
  124. id: disconn
  125. interval: 500
  126. onTriggered: {
  127. connectButton.visible = true
  128. //connectButton.text="断开"
  129. backButton.visible = true
  130. }
  131. }
  132. CButton {
  133. id: backButton
  134. textHeight: 50
  135. fontHeight: 0.4
  136. width: 250
  137. height: 50
  138. y:10
  139. visible:appModel.ready?false:true
  140. color: pressed ? textClickedColor : mainAppColor
  141. text: "返回"
  142. onClicked: {
  143. connectButton.enabled = true
  144. // carConnState.text = ""
  145. stack.pop()
  146. }
  147. }
  148. }
  149. Component.onCompleted: {
  150. loading.start()
  151. }
  152. }
  153. }