main.qml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. Item {
  70. id: cornerItem
  71. x: 0
  72. y: 0
  73. }
  74. property int activeFocusItemBottom : activeFocusItem == null ? 0 : Math.min(height, cornerItem.mapFromItem(activeFocusItem, 0, activeFocusItem.height).y + 50)
  75. Loader{
  76. id:myLoder
  77. anchors.centerIn: parent
  78. }
  79. //Component.onCompleted: myLoder.sourceComponent = firstpage
  80. Component{
  81. id:firstpage
  82. PageFirst{
  83. width:300
  84. height: 200
  85. anchors.centerIn: parent
  86. }
  87. }
  88. Component{
  89. id:mainpage
  90. PageMain{
  91. width: 1280
  92. height: 760
  93. anchors.centerIn: parent
  94. }
  95. }
  96. InputPanel {
  97. id: inputPanel
  98. z: 99
  99. x: 0
  100. y: main_window.height
  101. width: main_window.width
  102. states: State {
  103. name: "visible"
  104. when: inputPanel.active
  105. PropertyChanges {
  106. target: inputPanel
  107. y: main_window.height - inputPanel.height
  108. }
  109. }
  110. transitions: Transition {
  111. from: ""
  112. to: "visible"
  113. reversible: true
  114. ParallelAnimation {
  115. NumberAnimation {
  116. properties: "y"
  117. duration: 250
  118. easing.type: Easing.InOutQuad
  119. }
  120. }
  121. }
  122. }
  123. }