main.qml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. Window {
  10. id:main_window
  11. width: 1280
  12. height: 760
  13. visible: true
  14. title: qsTr("油气回收测试装备")
  15. flags:Qt.FramelessWindowHint
  16. Image {
  17. id: bg
  18. anchors.horizontalCenter: parent.horizontalCenter
  19. fillMode: Image.PreserveAspectFit
  20. source: "img/main_zjtj_bj.jpg"
  21. }
  22. Rectangle{
  23. id: logo
  24. x: 20
  25. y: 20
  26. width:300
  27. height:100
  28. color:"transparent"
  29. Image {
  30. anchors.fill:parent
  31. fillMode: Image.PreserveAspectFit
  32. source:"img/zjtj_logo.png"
  33. }
  34. }
  35. Button {
  36. text: "点击进入"
  37. font.bold: true
  38. font.pixelSize: 24
  39. width:240
  40. height:120
  41. anchors.centerIn: parent
  42. background: Image {
  43. anchors.fill:parent
  44. fillMode: Image.PreserveAspectFit
  45. source:"img/blue_button.png"
  46. }
  47. //icon.source: "img/blue_button.png"
  48. //icon.color: "transparent"
  49. onClicked: myLoder.sourceComponent = mainpage // 切换显示主页面
  50. }
  51. Button {
  52. //text: "点击进入"
  53. width:80
  54. height:80
  55. anchors.right: parent.right
  56. anchors.rightMargin: 40;
  57. anchors.bottom: parent.bottom
  58. anchors.bottomMargin: 40;
  59. //color:"transparent"
  60. background:Image {
  61. anchors.fill:parent
  62. fillMode: Image.PreserveAspectFit
  63. source:"img/shutdown_red.png"
  64. }
  65. onClicked: {
  66. Qt.quit()
  67. }
  68. }
  69. Text {
  70. id: ver_text
  71. anchors.left: parent.left
  72. anchors.bottom: parent.bottom
  73. anchors.leftMargin: 30
  74. anchors.bottomMargin: 70
  75. text: qsTr("SoftWare Version: V2.1.2")
  76. font.bold: true
  77. }
  78. Item {
  79. id: cornerItem
  80. x: 0
  81. y: 0
  82. }
  83. property int activeFocusItemBottom : activeFocusItem == null ? 0 : Math.min(height, cornerItem.mapFromItem(activeFocusItem, 0, activeFocusItem.height).y + 50)
  84. Loader{
  85. id:myLoder
  86. anchors.centerIn: parent
  87. }
  88. //Component.onCompleted: myLoder.sourceComponent = firstpage
  89. Component{
  90. id:firstpage
  91. PageFirst{
  92. width:300
  93. height: 200
  94. anchors.centerIn: parent
  95. }
  96. }
  97. Component{
  98. id:mainpage
  99. PageMain{
  100. width: 1280
  101. height: 760
  102. anchors.centerIn: parent
  103. }
  104. }
  105. InputPanel {
  106. id: inputPanel
  107. z: 99
  108. x: 0
  109. y: main_window.height
  110. width: main_window.width
  111. states: State {
  112. name: "visible"
  113. when: inputPanel.active
  114. PropertyChanges {
  115. target: inputPanel
  116. y: main_window.height - inputPanel.height
  117. }
  118. }
  119. transitions: Transition {
  120. from: ""
  121. to: "visible"
  122. reversible: true
  123. ParallelAnimation {
  124. NumberAnimation {
  125. properties: "y"
  126. duration: 250
  127. easing.type: Easing.InOutQuad
  128. }
  129. }
  130. }
  131. }
  132. }