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