Adding wip version for meego harmattan
[feedingit] / psa_harmattan / feedingit / deb_dist / feedingit-0.1.0 / debian / feedingit / usr / share / feedingit / qml / common / Switch.qml
1 import Qt 4.7
2
3 Item {
4     id: container
5
6     signal clicked
7
8     property string text
9     property string value
10
11     width: parent.width;
12     height: 86;
13     //anchors.fill: parent;
14
15 //    BorderImage {
16 //        id: buttonImage
17 //        source: "images/toolbutton.sci"
18 //        width: container.width; height: container.height
19 //    }
20 //    BorderImage {
21 //        id: pressed
22 //        opacity: 0
23 //        source: "images/toolbutton.sci"
24 //        width: container.width; height: container.height
25 //    }
26
27     Rectangle {
28         id: back
29         width: parent.width;
30         height: 82;
31         color: "#343434";
32         border.width : 4;
33         border.color: "black";
34         radius: 10;
35     }
36
37     Rectangle {
38         id: valueSwitch
39         color: (value=="False") ? "red" : "green";
40         border.width : 4;
41         border.color: "black";
42         radius: 10;
43         height: 40;
44         width: 40;
45         anchors.verticalCenter: back.verticalCenter
46         //anchors.verticalCenter: parent.verticalCenter
47         anchors.margins: 10;
48         anchors.right: back.right;
49         Text {
50             color: "white"
51             anchors.centerIn: valueSwitch; font.bold: true
52             text: (container.value == "False") ? "OFF" : "ON"; style: Text.Raised; styleColor: "black"
53         }
54     }
55
56     MouseArea {
57         id: mouseRegion
58         anchors.fill: back
59         onClicked: { container.clicked(); }
60     }
61     Text {
62         color: "white"
63         /*anchors.centerIn: back;*/ font.bold: true
64         anchors.left: parent.left;
65         anchors.margins: 10
66         anchors.verticalCenter: back.verticalCenter
67         text: container.text; style: Text.Raised; styleColor: "black"
68     }
69 //    states: [
70 //        State {
71 //            name: "Pressed"
72 //            when: mouseRegion.pressed == true
73 //            PropertyChanges { target: pressed; opacity: 1 }
74 //        }
75 //    ]
76 }