summaryrefslogtreecommitdiffstats
path: root/examples/demos/stocqt/content/CheckBox.qml
blob: 573408bb88f437dd6495c5d09f9fe740922e2163 (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
39
// Copyright (C) 2012 Research In Motion.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick

Item {
    id: button
    property bool buttonEnabled: true
    width: 30
    height: 30
    x: 5
    MouseArea {
        id: mouse
        anchors.fill: parent
        onClicked: {
            if (buttonEnabled)
                buttonEnabled = false;
            else
                buttonEnabled = true;
        }
    }
    Rectangle {
        id: checkbox
        width: 30
        height: 30
        border.color: "#999999"
        border.width: 1
        antialiasing: true
        radius: 2
        color: "transparent"
        Rectangle {
            anchors.fill: parent
            anchors.margins: 5
            antialiasing: true
            radius: 1
            color: mouse.pressed || buttonEnabled ? "#999999" : "transparent"
        }
    }
}