DButton.qml 895 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import QtQuick 2.15
  2. import QtQuick.Controls 2.15
  3. import DMusic 1.0
  4. Control {
  5. id: root
  6. height: 24
  7. implicitWidth: _text.width + 20
  8. property alias text: _text.text
  9. property alias textColor: _text.color
  10. property alias radius: _background.radius
  11. property bool onPanel: false
  12. signal click()
  13. property var cs: onPanel? Style.button.background.panel : Style.button.background.normal
  14. background: Rectangle {
  15. id: _background
  16. anchors.fill: root
  17. radius: 4
  18. color: _mouse.containsPress? cs.press : (_mouse.containsMouse? cs.hover : cs.normal)
  19. }
  20. contentItem: Item {
  21. anchors.fill: root
  22. DText {
  23. id: _text
  24. anchors.centerIn: parent
  25. text: "Скачать" // ?!? wtf
  26. }
  27. MouseArea {
  28. id: _mouse
  29. anchors.fill: parent
  30. hoverEnabled: true
  31. cursorShape: Qt.PointingHandCursor
  32. onClicked: root.click()
  33. }
  34. }
  35. }