DetailPage.qml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. Rectangle {
  16. width: 1440
  17. height: 820
  18. anchors.horizontalCenter: parent.horizontalCenter
  19. anchors.verticalCenter: parent.verticalCenter
  20. color: 'transparent'
  21. border.color: mainAppColor
  22. border.width: 1
  23. radius: 5
  24. Rectangle {
  25. width: 1280
  26. height: 720
  27. color: 'transparent'
  28. //color: 'blue'
  29. anchors.top: parent.top
  30. anchors.topMargin: 50
  31. anchors.horizontalCenter: parent.horizontalCenter
  32. // anchors.verticalCenter: parent.verticalCenter
  33. // CAM Panel
  34. Image {
  35. id: panelImg
  36. width: 1280
  37. height: 720
  38. fillMode: Image.Stretch
  39. }
  40. Connections {
  41. target: PanelImage
  42. onCallQmlRefeshPanelImg: {
  43. panelImg.source = ""
  44. panelImg.source = "image://PanelImage"
  45. }
  46. }
  47. }
  48. Text {
  49. id: carName
  50. anchors {
  51. top: myIcon.bottom
  52. topMargin: 10
  53. horizontalCenter: parent.horizontalCenter
  54. }
  55. text: name
  56. color: '#eaf4fc'
  57. font.family: alibaba.name
  58. // anchors.topMargin: 5
  59. font.pointSize: 20
  60. }
  61. // Text {
  62. // id: carConnState
  63. // anchors {
  64. // top: carName.bottom
  65. // topMargin: 10
  66. // horizontalCenter: parent.horizontalCenter
  67. // }
  68. // text: !appModel.ready ? "未连接" : "已连接"
  69. // color: '#eaf4fc'
  70. // font.family: alibaba.name
  71. // font.pointSize: 20
  72. // }
  73. Row {
  74. anchors.top: parent.bottom
  75. anchors.topMargin: 50
  76. anchors.horizontalCenter: parent.horizontalCenter
  77. CButton {
  78. id: connectButton
  79. textHeight: 50
  80. fontHeight: 0.4
  81. width: 180
  82. height: 50
  83. color: pressed ? textClickedColor : mainAppColor
  84. text: appModel.ready ? "断开" : "连接"
  85. onClicked: {
  86. if (!appModel.ready) {
  87. connectButton.visible = false
  88. loading.start()
  89. carSelect(uid)
  90. backButton.visible = false
  91. } else {
  92. connectButton.visible = false
  93. disconn.start()
  94. appModel.leaveCar()
  95. appModel.ready = false
  96. }
  97. }
  98. }
  99. spacing: 50
  100. CButton {
  101. id: backButton
  102. textHeight: 50
  103. fontHeight: 0.4
  104. width: 180
  105. height: 50
  106. color: pressed ? textClickedColor : mainAppColor
  107. text: "返回"
  108. onClicked: {
  109. connectButton.enabled = true
  110. // carConnState.text = ""
  111. stack.pop()
  112. }
  113. visible: true
  114. }
  115. }
  116. Timer {
  117. id: loading
  118. interval: 5000
  119. onTriggered: {
  120. connectButton.visible = true
  121. // loadingCount++
  122. // carConnState.text = "连接中" + Backend.dot(loadingCount)
  123. // if (loadingCount === 4)
  124. // loadingCount = 0
  125. }
  126. }
  127. Timer {
  128. id: disconn
  129. interval: 5000
  130. onTriggered: {
  131. connectButton.visible = true
  132. backButton.visible = true
  133. }
  134. }
  135. Component.onCompleted: {
  136. }
  137. }
  138. }