Dialog.qml 721 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2011 Nokia Corporation.
  3. */
  4. import Qt 4.7
  5. Rectangle {
  6. id: page
  7. property Item text: dialogText
  8. signal closed();
  9. signal clicked();
  10. function forceClose() {
  11. page.closed();
  12. page.opacity = 0;
  13. }
  14. function show(txt) {
  15. dialogText.text = txt;
  16. page.opacity = 1;
  17. }
  18. width: dialogText.width + 20; height: dialogText.height + 20
  19. color: "#373737"
  20. border.width: 1
  21. opacity: 0
  22. Behavior on opacity {
  23. NumberAnimation { duration: 1000 }
  24. }
  25. Text { id: dialogText; anchors.centerIn: parent; color: "white"; text: "Hello World!" }
  26. MouseArea {
  27. anchors.fill: parent
  28. onClicked: page.clicked()
  29. }
  30. }