CButton.qml 851 B

12345678910111213141516171819202122232425262728293031323334
  1. import QtQuick 2.6
  2. import QtQuick.Controls 2.0
  3. Rectangle {
  4. id: button
  5. signal clicked
  6. property alias text: text.text
  7. border.width: 1
  8. border.color: mainAppColor
  9. radius: 3
  10. property real textHeight: height - 2
  11. property real fontHeight: 0.3
  12. property bool pressed: mouse.pressed
  13. property real implicitMargin: (width - text.implicitWidth) / 2
  14. Text {
  15. id: text
  16. anchors.left: parent.left
  17. anchors.right: parent.right
  18. anchors.top: parent.top
  19. height: parent.textHeight
  20. horizontalAlignment: Text.AlignHCenter
  21. verticalAlignment: Text.AlignVCenter
  22. font.pixelSize: height * fontHeight
  23. color: "#ffffff"
  24. font.family: alibaba.name
  25. }
  26. MouseArea {
  27. id: mouse
  28. anchors.fill: parent
  29. onClicked: button.clicked()
  30. }
  31. }