summaryrefslogtreecommitdiffstats
path: root/examples/sensors/qmlqtsensors5/Button.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sensors/qmlqtsensors5/Button.qml')
-rw-r--r--examples/sensors/qmlqtsensors5/Button.qml34
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/sensors/qmlqtsensors5/Button.qml b/examples/sensors/qmlqtsensors5/Button.qml
new file mode 100644
index 00000000..4e9c74c2
--- /dev/null
+++ b/examples/sensors/qmlqtsensors5/Button.qml
@@ -0,0 +1,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);
+ }
+}