main.qml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. import QtQuick
  2. import QtQuick.Layouts
  3. import QtQuick.Controls
  4. import QtDataVisualization 1.2
  5. import "components"
  6. Item {
  7. id: rootItem
  8. width: 1920
  9. height: 1080
  10. property string textTitle: '湛江钢铁非视距远程操控系统'
  11. property string mainTextColor: '#29b6fb'
  12. property string mainAppColor: '#29b6fb'
  13. property string textClickedColor: '#7ad4ff'
  14. property string textColorGreen: '#00FFFF'
  15. property color popupBgColorErr: "#b44"
  16. property color popupBgColorWarn: "#f7bd3e"
  17. property color popupBgColorOK: "#29b6fb"
  18. property color popupTextColor: "#ffffff"
  19. FontLoader {
  20. id: alibaba
  21. source: "qrc:/components/font/Alibaba-PuHuiTi-Bold.ttf"
  22. }
  23. FontLoader {
  24. id: fontawesome
  25. source: "qrc:/components/font/fontawesome-webfont.ttf"
  26. }
  27. FontLoader {
  28. id: digtalFont
  29. source: "qrc:/components/font/fontawesome-webfont.ttf"
  30. }
  31. Popup {
  32. id: popup
  33. property alias popMessage: message.text
  34. property alias popColor: popupBg.color
  35. background: Rectangle {
  36. id: popupBg
  37. implicitWidth: rootItem.width
  38. implicitHeight: 60
  39. }
  40. y: (rootItem.height - 60)
  41. modal: true
  42. focus: true
  43. closePolicy: Popup.CloseOnPressOutside
  44. Text {
  45. id: message
  46. anchors.centerIn: parent
  47. font.pointSize: 12
  48. color: popupTextColor
  49. font.family: '黑体'
  50. }
  51. onOpened: popupClose.start()
  52. }
  53. signal qmlSignalMaxWindow
  54. signal qmlSignalQuit
  55. //在QML中定义了一个状态机(State Machine),每个状态都有一个属性更改(PropertyChanges),分别用于设置panelView的不透明度
  56. state: "loading"
  57. states: [
  58. //在"loading"状态下,panelView的不透明度被设置为0,即完全透明
  59. State {
  60. name: "loading"
  61. PropertyChanges {
  62. target: panelView
  63. opacity: 0
  64. }
  65. },
  66. //在"loaded"状态下,panelView的不透明度被设置为1,即完全不透明
  67. State {
  68. name: "loaded"
  69. PropertyChanges {
  70. target: panelView
  71. opacity: 1
  72. }
  73. }
  74. ]
  75. Item {
  76. id: panelView
  77. width: 1920
  78. height: 1080
  79. visible: true
  80. x: 0
  81. y: 0
  82. Dialog {
  83. id: closeDialog
  84. visible: false
  85. modal: true
  86. x: (parent.width - width) / 2
  87. y: (parent.height - height) / 2
  88. closePolicy: Popup.NoAutoClose
  89. implicitWidth: 500
  90. implicitHeight: 300
  91. Text {
  92. text: "该账号已登录,程序将自动退出"
  93. font.pointSize: 24
  94. font.family: alibaba.name
  95. color: mainAppColor
  96. anchors.horizontalCenter: parent.horizontalCenter
  97. y: 100
  98. }
  99. onOpened: {
  100. closeWinTimer.start()
  101. }
  102. }
  103. Dialog {
  104. id: panelDialog
  105. visible: false
  106. modal: true
  107. x: (parent.width - width) / 2
  108. y: (parent.height - height) / 2
  109. closePolicy: Popup.NoAutoClose
  110. implicitWidth: 500
  111. implicitHeight: 300
  112. Text {
  113. text: "确认退出吗?"
  114. font.pointSize: 24
  115. font.family: alibaba.name
  116. color: mainAppColor
  117. anchors.horizontalCenter: parent.horizontalCenter
  118. y: 100
  119. }
  120. Row {
  121. height: parent.height
  122. anchors.horizontalCenter: parent.horizontalCenter
  123. y: 200
  124. CButton {
  125. id: cancelBtn
  126. textHeight: 50
  127. fontHeight: 0.4
  128. width: 150
  129. height: 50
  130. color: pressed ? textClickedColor : mainAppColor
  131. text: "取消"
  132. onClicked: panelDialog.visible = false
  133. }
  134. spacing: 50
  135. CButton {
  136. id: quitButton
  137. textHeight: 50
  138. fontHeight: 0.4
  139. width: 150
  140. height: 50
  141. color: pressed ? textClickedColor : mainAppColor
  142. text: "退出"
  143. onClicked: {
  144. //readThread.close()
  145. videoWindow.close()
  146. rootItem.qmlSignalQuit()
  147. }
  148. }
  149. /* Connections {
  150. target: readThread
  151. onPlayState:{
  152. if(state===1){
  153. delete readThread
  154. videoWindow.close()
  155. rootItem.qmlSignalQuit()
  156. }
  157. }
  158. }*/
  159. }
  160. }
  161. PanelWindow {
  162. id: subPage
  163. focus: true
  164. Keys.enabled: true
  165. Keys.onEscapePressed: {
  166. panelDialog.visible = true
  167. }
  168. Component.onCompleted: {
  169. appModel.radar1 = 5000
  170. appModel.radar2 = 0
  171. appModel.radar3 = 0
  172. appModel.radar4 = 0
  173. appModel.radar5 = 0
  174. appModel.radar6 = 0
  175. appModel.radar7 = 0
  176. appModel.radar8 = 0
  177. appModel.ping = 0
  178. appModel.ready = 0
  179. appModel.fuelLevel=666
  180. appModel.imux=666
  181. appModel.imuy=666
  182. appModel.engineTemperature=666
  183. appModel.liftPilotPressureSensor_F= true
  184. appModel.boomAngleSensor_F = true
  185. }
  186. }
  187. Window {
  188. id: videoWindow
  189. property int wndIndex: 0
  190. visible: true
  191. width: 3840
  192. height: 1080
  193. //原版
  194. x: 1920
  195. //屏幕移动调整位置
  196. //x: 1920+650
  197. //x: 1920+1920
  198. //档位显示
  199. //x: 0-1500
  200. //灯显示
  201. //x: 0
  202. title: qsTr("Hyper vision remote control System")
  203. flags: Qt.Window | Qt.FramelessWindowHint
  204. screen: Qt.application.screens[wndIndex]
  205. MainWindow {}
  206. /*
  207. Component.onCompleted: {
  208. appModel.radar1 = 5000
  209. appModel.radar2 = 0
  210. appModel.radar3 = 0
  211. appModel.radar4 = 0
  212. appModel.radar5 = 0
  213. appModel.radar6 = 0
  214. appModel.radar7 = 0
  215. appModel.radar8 = 0
  216. appModel.ping = 0
  217. appModel.ready = 0
  218. appModel.fuelLevel=666
  219. appModel.imux=666
  220. appModel.imuy=666
  221. appModel.engineTemperature=666
  222. }*/
  223. }
  224. }
  225. Timer {
  226. id: splashScreenClose
  227. interval: 1000
  228. onTriggered: {
  229. splashScreenLoader.item.visible = false
  230. splashScreenLoader.source = ""
  231. rootItem.qmlSignalMaxWindow()
  232. rootItem.state = "loaded"
  233. }
  234. }
  235. Loader {
  236. id: splashScreenLoader
  237. source: "qrc:/components/SplashScreen.qml"
  238. onLoaded: {
  239. splashScreenClose.start()
  240. }
  241. }
  242. }