Adding wip version for meego harmattan
[feedingit] / psa_harmattan / feedingit / deb_dist / feedingit-0.1.0 / qml / common / Button.qml
1 import Qt 4.7
2
3 Item {
4     id: container
5
6     signal clicked
7
8     property string text
9     property string imageSource: ""
10     property int imageRotation: 0
11
12     property alias iconRotation: icon.rotation
13
14     BorderImage {
15         id: buttonImage
16         source: "images/toolbutton.sci"
17         width: container.width; height: container.height
18         //visible: (container.imageSource=="")
19     }
20     BorderImage {
21         id: pressed
22         opacity: 0
23         source: "images/toolbutton.sci"
24         width: container.width; height: container.height
25         //visible: (container.imageSource=="")
26     }
27     Image {
28         id: icon
29         source: container.imageSource
30         rotation: container.imageRotation
31         //fillMode: Image.PreserveAspectFit
32         smooth: true
33         anchors.centerIn: buttonImage;
34         //width: container.width; height: container.height
35     }
36     MouseArea {
37         id: mouseRegion
38         anchors.fill: buttonImage
39         onClicked: { container.clicked(); }
40     }
41     Text {
42         color: "white"
43         anchors.centerIn: buttonImage; font.bold: true
44         text: container.text; style: Text.Raised; styleColor: "black"
45         visible: (container.imageSource=="")
46     }
47     states: [
48         State {
49             name: "Pressed"
50             when: mouseRegion.pressed == true
51             PropertyChanges { target: pressed; opacity: 1 }
52         }
53     ]
54 }