Commandbutton.qml 865 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import QtQuick 1.0
  2. Rectangle {
  3. color: "transparent"
  4. id: commandButton
  5. width: 60
  6. height: 60
  7. signal stateChancgeRequested()
  8. property string previousView : ""
  9. onPreviousViewChanged: (previousView!= "" ? state = "back" : state = "")
  10. Image {
  11. id: icon
  12. source: "qrc:/shut"
  13. opacity: commandButtonMa.pressed ? 0.5 : 1
  14. }
  15. MouseArea {
  16. id: commandButtonMa
  17. anchors.fill: parent
  18. onClicked: {
  19. Qt.quit();
  20. }
  21. }
  22. states: [
  23. State{
  24. name:"back"
  25. PropertyChanges {
  26. target: commandButtonMa;
  27. onClicked: {
  28. stateChancgeRequested();
  29. }
  30. }
  31. PropertyChanges { target: icon; source: "qrc:/back"}
  32. }
  33. ]
  34. }