summaryrefslogtreecommitdiffstats
path: root/examples/sensors/qmlqtsensors5/SelectionButton.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sensors/qmlqtsensors5/SelectionButton.qml')
-rw-r--r--examples/sensors/qmlqtsensors5/SelectionButton.qml37
1 files changed, 37 insertions, 0 deletions
diff --git a/examples/sensors/qmlqtsensors5/SelectionButton.qml b/examples/sensors/qmlqtsensors5/SelectionButton.qml
new file mode 100644
index 00000000..e258d5e1
--- /dev/null
+++ b/examples/sensors/qmlqtsensors5/SelectionButton.qml
@@ -0,0 +1,37 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: button
+ width: 100
+ height: 25
+ property alias text: t.text
+ property bool checked
+ signal clicked
+
+ Image{
+ id: image
+ x: 0
+ width: 15
+ height: 15
+ source: (button.checked == true ? "checked.gif" : "unchecked.gif")
+ }
+
+ Text{
+ x: image.x + image.width + 10
+ id: t
+ }
+
+ MouseArea{
+ anchors.fill: button
+ onClicked: {
+ setCheck(true);
+ button.clicked();
+ }
+ }
+
+ function setCheck(val)
+ {
+ checked = val;
+ image.source = (button.checked == true ? "checked.gif" : "unchecked.gif");
+ }
+}