main.qml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. import QtQuick 2.15
  2. import QtQuick.Window 2.15
  3. import QtQuick.Layouts 1.3
  4. import QtQuick.Controls 2.14
  5. import QtQuick.Dialogs 1.3
  6. import QtQuick.Controls.Styles 1.4
  7. import QtQuick.VirtualKeyboard 2.15
  8. import TService 1.0
  9. import BackendLogic 1.0
  10. Window {
  11. id:main_window
  12. width: 1280
  13. height: 760
  14. visible: true
  15. title: qsTr("油气回收测试装备")
  16. flags:Qt.FramelessWindowHint
  17. Image {
  18. id: bg
  19. anchors.horizontalCenter: parent.horizontalCenter
  20. fillMode: Image.PreserveAspectFit
  21. source: "img/main_zjtj_bj.jpg"
  22. }
  23. BackendLogic {
  24. id: backend
  25. }
  26. Rectangle{
  27. id: logo
  28. x: 20
  29. y: 20
  30. width:300
  31. height:100
  32. color:"transparent"
  33. Image {
  34. anchors.fill:parent
  35. fillMode: Image.PreserveAspectFit
  36. source:"img/zjtj_logo.png"
  37. }
  38. }
  39. Button {
  40. text: "点击进入"
  41. font.bold: true
  42. font.pixelSize: 24
  43. width:240
  44. height:120
  45. anchors.centerIn: parent
  46. background: Image {
  47. anchors.fill:parent
  48. fillMode: Image.PreserveAspectFit
  49. source:"img/blue_button.png"
  50. }
  51. //icon.source: "img/blue_button.png"
  52. //icon.color: "transparent"
  53. onClicked: myLoder.sourceComponent = mainpage // 切换显示主页面
  54. }
  55. Button {
  56. //text: "点击进入"
  57. width:80
  58. height:80
  59. anchors.right: parent.right
  60. anchors.rightMargin: 40;
  61. anchors.bottom: parent.bottom
  62. anchors.bottomMargin: 40;
  63. //color:"transparent"
  64. background:Image {
  65. anchors.fill:parent
  66. fillMode: Image.PreserveAspectFit
  67. source:"img/shutdown_red.png"
  68. }
  69. onClicked: {
  70. backend.shutdown()
  71. }
  72. }
  73. Rectangle{
  74. id: info
  75. x: 30
  76. y: 650
  77. width:500
  78. height:400
  79. color:"transparent"
  80. Column{
  81. spacing: 2
  82. Text {
  83. id: ver_text
  84. text: qsTr("软件版本: V2.1.2")
  85. font.bold: true
  86. }
  87. Text {
  88. id: model_text
  89. text: qsTr("")
  90. font.bold: true
  91. }
  92. Text {
  93. id: devid_text
  94. text: qsTr("")
  95. font.bold: true
  96. }
  97. Text {
  98. id: manufacture_text
  99. text: qsTr("")
  100. font.bold: true
  101. }
  102. }
  103. }
  104. Item {
  105. id: cornerItem
  106. x: 0
  107. y: 0
  108. }
  109. property int activeFocusItemBottom : activeFocusItem == null ? 0 : Math.min(height, cornerItem.mapFromItem(activeFocusItem, 0, activeFocusItem.height).y + 50)
  110. Loader{
  111. id:myLoder
  112. anchors.centerIn: parent
  113. }
  114. Component.onCompleted:{
  115. var jsonobj = backend.getDeviceInfo()
  116. model_text.text = "设备型号:"+jsonobj.model
  117. devid_text.text = "设备ID:"+jsonobj.id
  118. manufacture_text.text = "制造商:"+jsonobj.manufacture
  119. }
  120. Component{
  121. id:firstpage
  122. PageFirst{
  123. width:300
  124. height: 200
  125. anchors.centerIn: parent
  126. }
  127. }
  128. Component{
  129. id:mainpage
  130. PageMain{
  131. width: 1280
  132. height: 760
  133. anchors.centerIn: parent
  134. }
  135. }
  136. InputPanel {
  137. id: inputPanel
  138. z: 99
  139. x: 0
  140. y: main_window.height
  141. width: main_window.width
  142. states: State {
  143. name: "visible"
  144. when: inputPanel.active
  145. PropertyChanges {
  146. target: inputPanel
  147. y: main_window.height - inputPanel.height
  148. }
  149. }
  150. transitions: Transition {
  151. from: ""
  152. to: "visible"
  153. reversible: true
  154. ParallelAnimation {
  155. NumberAnimation {
  156. properties: "y"
  157. duration: 250
  158. easing.type: Easing.InOutQuad
  159. }
  160. }
  161. }
  162. }
  163. }