aboutsummaryrefslogtreecommitdiffstats
path: root/DemoApplication/controls/CNButton.qml
diff options
context:
space:
mode:
Diffstat (limited to 'DemoApplication/controls/CNButton.qml')
-rw-r--r--DemoApplication/controls/CNButton.qml38
1 files changed, 38 insertions, 0 deletions
diff --git a/DemoApplication/controls/CNButton.qml b/DemoApplication/controls/CNButton.qml
new file mode 100644
index 0000000..33299d1
--- /dev/null
+++ b/DemoApplication/controls/CNButton.qml
@@ -0,0 +1,38 @@
+import QtQuick 2.0
+import QtQuick.Controls 2.2
+import CursorNavigation 1.0
+
+Button {
+ id: root
+ implicitWidth: (textLabel.contentWidth + 40)
+ implicitHeight: 40
+
+ CursorNavigation.acceptsCursor: true
+ property bool hasCursor: CursorNavigation.hasCursor
+
+ background: Rectangle {
+ anchors.fill: parent
+ radius: 40
+ opacity: root.pressed ? 0.6 : 0.4
+ color: "grey"
+ }
+
+ contentItem: Item {
+ anchors.fill: parent
+ Label {
+ id: textLabel
+ anchors.centerIn: parent
+ font.pixelSize: 14
+ color: "blue"
+ text: root.text
+ }
+
+ Rectangle {
+ border.width: 2
+ border.color: "red"
+ anchors.fill: parent
+ visible: root.hasCursor
+ color: "transparent"
+ }
+ }
+}