blob: 4e9c74c2a0520b835e4593ca1ce9e33c57c7385f (
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
|
import QtQuick 2.0
Rectangle {
id: button
width: 100
height: 20
property alias text: t.text
property bool checked
signal clicked
property color checkColor;
property color unCheckColor;
border.width: 1
radius: 2
Text{
x: 0
id: t
anchors.fill: button
}
MouseArea{
anchors.fill: button
onClicked: {
setCheck(!button.checked);
button.clicked();
}
}
function setCheck(val)
{
checked = val;
button.color = (button.checked == true ? checkColor : unCheckColor);
}
}
|