TitleManualButton.qml 812 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import QtQuick 2.15
  2. import DMusic 1.0
  3. import "components"
  4. Rectangle {
  5. id: root
  6. property url icon: ""
  7. property var style: Style.header.button
  8. signal click()
  9. signal pressed()
  10. enabled: true
  11. visible: enabled
  12. width: enabled? 50 : 0
  13. height: 40
  14. color: _mouse.containsPress? style.background.pressed: _mouse.containsMouse? style.background.hover : style.background.normal
  15. Icon {
  16. anchors.centerIn: root
  17. visible: root.enabled
  18. src: icon
  19. color: _mouse.containsPress? style.color.pressed: _mouse.containsMouse? style.color.hover : style.color.normal
  20. }
  21. MouseArea {
  22. id: _mouse
  23. anchors.fill: root
  24. hoverEnabled: true
  25. onClicked: if (enabled) { root.click(); _root.focus = true }
  26. onPressed: if (enabled) root.pressed()
  27. }
  28. }