utils/fgqcanvas/qml/Button.qml
raw| 1 | import QtQuick 2.0 |
| 2 | |
| 3 | Rectangle { |
| 4 | id: root |
| 5 | |
| 6 | property alias label: labelText.text |
| 7 | property bool enabled: true |
| 8 | |
| 9 | signal clicked |
| 10 | |
| 11 | border.width: 2 |
| 12 | border.color: enabled ? "orange" : "9f9f9f" |
| 13 | |
| 14 | color: "#3f3f3f" |
| 15 | implicitWidth: 100 |
| 16 | implicitHeight: 30 |
| 17 | |
| 18 | Text { |
| 19 | id: labelText |
| 20 | anchors.centerIn: parent |
| 21 | color: enabled ? "white" : "9f9f9f" |
| 22 | } |
| 23 | |
| 24 | MouseArea { |
| 25 | anchors.fill: parent |
| 26 | enabled: root.enabled |
| 27 | |
| 28 | onClicked: { |
| 29 | root.clicked(); |
| 30 | } |
| 31 | } |
| 32 | } |