Settings dialog infrastructure
[quicknewsreader] / qml / QuickNewsReader / content / view / FancyButton.qml
1 /* This file is part of MeeGoFrames Component Library
2  * Copyright (C) 2011 Martin Grimme  <martin.grimme _AT_ gmail.com>
3  *
4  * This program is free software; you can redistribute it, even commercially, 
5  * as long as this copyright notice remains in place.
6  *
7  * This library is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  */
11
12
13 import Qt 4.7
14
15 Rectangle {
16
17     property alias icon: imageLabel.source
18
19     signal clicked()
20
21     id: button
22     width: 70
23     height: 70
24
25     radius: 3
26     color: "#a0000000"
27
28
29     states: [
30         State {
31             name: "pressed"
32             when: mouseArea.pressed
33             PropertyChanges {
34                 target: button
35                 color: "#606060"
36                 scale: 0.9
37             }
38         }
39     ]
40
41     Behavior on color {
42         ColorAnimation { duration: 100 }
43     }
44
45     Behavior on scale {
46         NumberAnimation { duration: 100 }
47     }
48
49     Image {
50         anchors.centerIn: parent
51         id: imageLabel
52         visible: source != ""
53         anchors.horizontalCenter: parent.horizontalCenter
54     }
55
56     MouseArea {
57         id: mouseArea
58         anchors.fill: parent
59         onClicked: parent.clicked()
60     }
61 }