aboutsummaryrefslogtreecommitdiffstats
path: root/DemoApplication/controls/CNButton.qml
blob: 33299d1734a04c360813baaca65c68450574d56a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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"
        }
    }
}