main.qml 4.2 KB

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