Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import QtQuick 2.4
  2. import QtQuick.Window 2.0
  3. import QtQuick.Controls 1.2
  4. import QtQuick.Layouts 1.1
  5.  
  6. Window {
  7. id: mainWindow
  8. width: 600
  9. height: 600
  10. visible: true
  11.  
  12. ColumnLayout
  13. {
  14. width: parent ? parent.width : 200
  15. Label
  16. {
  17. Layout.fillWidth: true
  18. text: "<h2>MyApp</h2>"
  19. horizontalAlignment: Text.AlignHCenter
  20. }
  21. RowLayout
  22. {
  23. Layout.fillWidth: true
  24. Layout.fillHeight: true
  25. Label
  26. {
  27. Layout.fillWidth: true
  28. text: "Show hidden text"
  29. }
  30. Switch
  31. {
  32. id: someswitch
  33. checked: false
  34. }
  35. }
  36. Label
  37. {
  38. id: myText
  39. text: "dummy"
  40. wrapMode: Text.WordWrap
  41. clip: true
  42. Layout.fillWidth: true
  43. Layout.preferredHeight: 0
  44.  
  45. states:
  46. [
  47. State
  48. {
  49. name: "visible"
  50. when: someswitch.checked
  51. PropertyChanges { target: myText; height: implicitHeight }
  52. }
  53. ]
  54.  
  55. Behavior on height
  56. {
  57. NumberAnimation { duration: 100 }
  58. }
  59. }
  60. }
  61. }