main.qml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import QtQuick 2.0
  2. import "QUItIndicators"
  3. Image {
  4. id: root
  5. property string loadedDemo: ""
  6. width: 1280
  7. height: 720
  8. source: "images/background.jpg"
  9. onLoadedDemoChanged: {
  10. if (loadedDemo == "" || loadedDemo == "Wall" || loadedDemo == "Huge") {
  11. contentArea.interactive = false;
  12. } else {
  13. contentArea.interactive = true;
  14. }
  15. if (loadedDemo == "") {
  16. loader.source = "";
  17. descriptionText.text = "";
  18. } else {
  19. loader.source = "examples/" + loadedDemo + ".qml";
  20. }
  21. }
  22. Text {
  23. anchors.horizontalCenter: parent.horizontalCenter
  24. y: 15
  25. text: "QUIt Indicators"
  26. font.pixelSize: 32
  27. color: "#ffffff"
  28. }
  29. Text {
  30. id: descriptionText
  31. anchors.horizontalCenter: parent.horizontalCenter
  32. y: 55
  33. font.pixelSize: 16
  34. color: "#b0b0b0"
  35. }
  36. Image {
  37. width: parent.width - 180
  38. x: 90
  39. y: 85
  40. z: 10
  41. source: "images/small_dot.png"
  42. fillMode: Image.TileHorizontally
  43. opacity: 0.1
  44. }
  45. ListModel {
  46. id: examplesModel
  47. ListElement {
  48. name: "Gallery"
  49. title: "Indicators gallery"
  50. }
  51. ListElement {
  52. name: "Huge"
  53. title: "Huge ProgressIndicator"
  54. }
  55. ListElement {
  56. name: "BusyStressTest"
  57. title: "BusyIndicator - Stress test"
  58. }
  59. ListElement {
  60. name: "ProgressStressTest"
  61. title: "ProgressIndicator - Stress test"
  62. }
  63. ListElement {
  64. name: "Wall"
  65. title: "Picture Wall demo"
  66. }
  67. }
  68. Column {
  69. anchors.horizontalCenter: parent.horizontalCenter
  70. y: 140
  71. width: 320
  72. spacing: 16
  73. opacity: 1.0 - contentArea.opacity
  74. Repeater {
  75. model: examplesModel
  76. Button {
  77. text: model.title
  78. onClicked: {
  79. loadedDemo = model.name
  80. descriptionText.text = model.title
  81. }
  82. }
  83. }
  84. }
  85. Flickable {
  86. id: contentArea
  87. anchors.fill: parent
  88. anchors.topMargin: 100
  89. opacity: loadedDemo != ""
  90. contentHeight: loader.height
  91. visible: loadedDemo != ""
  92. clip: true
  93. Behavior on opacity {
  94. NumberAnimation {
  95. duration: 500
  96. easing.type: Easing.InOutQuad
  97. }
  98. }
  99. Loader {
  100. id: loader
  101. width: parent.width - 128
  102. x: 64
  103. }
  104. }
  105. Image {
  106. source: "images/back.png"
  107. opacity: loadedDemo != ""
  108. Behavior on opacity {
  109. NumberAnimation {
  110. duration: 400
  111. }
  112. }
  113. MouseArea {
  114. anchors.fill: parent
  115. onClicked: {
  116. loadedDemo = "";
  117. }
  118. }
  119. }
  120. }