Sheet.qml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
  2. import QtQuick 1.1
  3. import Qt.labs.components.native 1.0
  4. import "../EvidencehuntCore" 1.0
  5. Rectangle {
  6. /*
  7. id: welcomeSheet
  8. anchors.fill: parent
  9. color: '#ffffff'
  10. opacity: 0
  11. z: 1000
  12. */
  13. property string title;
  14. property alias content: contentItem.children;
  15. anchors.fill: parent
  16. color: '#ffffff'
  17. opacity: 0
  18. z: 1000
  19. Rectangle {
  20. id: sheetMenuBar
  21. anchors.top: parent.top
  22. anchors.left: parent.left
  23. anchors.right: parent.right
  24. height: 68
  25. gradient: Gradient {
  26. GradientStop { position: 0.0; color: "#aaaaaa" }
  27. GradientStop { position: 0.33; color: "#cccccc" }
  28. GradientStop { position: 1.0; color: "#888888" }
  29. }
  30. z: 1001
  31. Text {
  32. font.pixelSize: 26;
  33. font.bold: true;
  34. text: title;
  35. anchors.top: parent.top;
  36. anchors.left: parent.left;
  37. anchors.topMargin: 16;
  38. anchors.leftMargin: 16
  39. }
  40. Button {
  41. id: closeSheetButton
  42. text: qsTr("__CLOSE__") + emptyString
  43. anchors.top: parent.top;
  44. anchors.right: parent.right;
  45. anchors.topMargin: 16;
  46. anchors.rightMargin: 16
  47. onClicked: {
  48. parent.parent.close();
  49. }
  50. }
  51. }
  52. Item {
  53. id: contentItem
  54. anchors.top: sheetMenuBar.bottom
  55. anchors.bottom: parent.bottom
  56. anchors.left: parent.left
  57. anchors.right: parent.right
  58. }
  59. PropertyAnimation {
  60. id: sheetAnimation
  61. property: "opacity"; to: 1; duration: 500
  62. }
  63. function open() {
  64. sheetAnimation.to = 1;
  65. sheetAnimation.target = this;
  66. sheetAnimation.start();
  67. }
  68. function close() {
  69. sheetAnimation.to = 0;
  70. sheetAnimation.target = this;
  71. sheetAnimation.start();
  72. }
  73. }