main.qml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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_img
  19. anchors.horizontalCenter: parent.horizontalCenter
  20. fillMode: Image.PreserveAspectFit
  21. //source: "img/main_zjtj_bj.jpg"
  22. //source: "img/main_jl_bj.jpg"
  23. }
  24. BackendLogic {
  25. id: backend
  26. }
  27. Rectangle{
  28. id: logo
  29. x: 20
  30. y: 20
  31. width:300
  32. height:100
  33. color:"transparent"
  34. Image {
  35. id:logo_img
  36. anchors.fill:parent
  37. fillMode: Image.PreserveAspectFit
  38. //source:"img/zjtj_logo.png"
  39. //source:"img/jl_logo.png"
  40. }
  41. }
  42. UserButton {
  43. text: "登 录"
  44. font.bold: true
  45. font.pixelSize: 24
  46. width:180
  47. height:60
  48. anchors.centerIn: parent
  49. /*
  50. background: Image {
  51. anchors.fill:parent
  52. fillMode: Image.PreserveAspectFit
  53. source:"img/blue_button.png"
  54. }
  55. */
  56. //icon.source: "img/blue_button.png"
  57. //icon.color: "transparent"
  58. onClicked: myLoder.sourceComponent = mainpage // 切换显示主页面
  59. }
  60. Button {
  61. //text: "点击进入"
  62. width:80
  63. height:80
  64. anchors.right: parent.right
  65. anchors.rightMargin: 40;
  66. anchors.bottom: parent.bottom
  67. anchors.bottomMargin: 40;
  68. //color:"transparent"
  69. background:Image {
  70. anchors.fill:parent
  71. fillMode: Image.PreserveAspectFit
  72. source:"img/shutdown_red.png"
  73. }
  74. onClicked: {
  75. backend.shutdown()
  76. }
  77. }
  78. Rectangle{
  79. id: info
  80. x: 30
  81. y: 650
  82. width:500
  83. height:400
  84. color:"transparent"
  85. Column{
  86. spacing: 2
  87. Text {
  88. id: ver_text
  89. text: qsTr("软件版本: V2.1.2")
  90. font.bold: true
  91. }
  92. Text {
  93. id: model_text
  94. text: qsTr("")
  95. font.bold: true
  96. }
  97. Text {
  98. id: devid_text
  99. text: qsTr("")
  100. font.bold: true
  101. }
  102. Text {
  103. id: manufacture_text
  104. text: qsTr("")
  105. font.bold: true
  106. }
  107. }
  108. }
  109. Item {
  110. id: cornerItem
  111. x: 0
  112. y: 0
  113. }
  114. property int activeFocusItemBottom : activeFocusItem == null ? 0 : Math.min(height, cornerItem.mapFromItem(activeFocusItem, 0, activeFocusItem.height).y + 50)
  115. Loader{
  116. id:myLoder
  117. anchors.centerIn: parent
  118. }
  119. Component.onCompleted:{
  120. var jsonobj = backend.getDeviceInfo()
  121. model_text.text = "设备型号:"+jsonobj.model
  122. devid_text.text = "设备ID:"+jsonobj.id
  123. //manufacture_text.text = "制造商:"+jsonobj.manufacture
  124. if("JL-VRST-2000" === jsonobj.model){
  125. bg_img.source = "img/main_jl_bj.jpg"
  126. logo_img.source = "img/jl_logo.png"
  127. manufacture_text.text = "制造商:"+jsonobj.manufacture
  128. }else if("JL-VRST-2001" === jsonobj.model){
  129. bg_img.source = "img/main_zjtj_bj.jpg"
  130. logo_img.source = "img/zjtj_logo.png"
  131. }
  132. }
  133. Component{
  134. id:firstpage
  135. PageFirst{
  136. width:300
  137. height: 200
  138. anchors.centerIn: parent
  139. }
  140. }
  141. Component{
  142. id:mainpage
  143. PageMain{
  144. width: 1280
  145. height: 760
  146. anchors.centerIn: parent
  147. }
  148. }
  149. InputPanel {
  150. id: inputPanel
  151. z: 99
  152. x: 0
  153. y: main_window.height
  154. width: main_window.width
  155. states: State {
  156. name: "visible"
  157. when: inputPanel.active
  158. PropertyChanges {
  159. target: inputPanel
  160. y: main_window.height - inputPanel.height
  161. }
  162. }
  163. transitions: Transition {
  164. from: ""
  165. to: "visible"
  166. reversible: true
  167. ParallelAnimation {
  168. NumberAnimation {
  169. properties: "y"
  170. duration: 250
  171. easing.type: Easing.InOutQuad
  172. }
  173. }
  174. }
  175. }
  176. }