Guest User

Untitled

a guest
Dec 14th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import QtQuick 2.0
  2. import QtQuick.Controls 2.0
  3.  
  4. Popup {
  5. id: popup
  6. modal: false
  7. focus: false
  8. property alias text: txt.text
  9.  
  10. closePolicy: Popup.NoAutoClose // To close click the notification or wait 5 seconds
  11.  
  12. Timer {
  13. id: timer
  14. interval: 5000 // milliseconds
  15. running: true
  16. repeat: false
  17. onTriggered: {
  18. popup.close()
  19. }
  20. }
  21. contentItem: Item {
  22. implicitWidth: txt.implicitWidth
  23. implicitHeight: txt.implicitHeight
  24.  
  25. anchors.fill: parent
  26. MouseArea {
  27. anchors.fill: parent
  28. onClicked: {
  29. popup.close()
  30. }
  31. }
  32. Text {
  33. id: txt
  34. }
  35. }
  36. onOpened: {
  37. timer.start()
  38. }
  39. }
Add Comment
Please, Sign In to add comment