6632be4b09a4115b9f75f5822359069f78e1eae3
[ubi] / qml / ubi / components / ToolIcon.qml
1 import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
2 import "../UIConstants.js" as Const
3
4 Item {
5     id: root
6
7     property string iconSource
8     property bool pressed: mouseArea.pressed
9     property string color: Const.TRANSPARENT
10
11     signal clicked
12     signal pressAndHold
13
14     width: 56
15     height: 56
16
17     Rectangle {
18         id: background
19         anchors { fill: parent; margins: 6 }
20         //color: root.color
21         color: "black"
22         opacity: 0.1
23         radius: 10
24     }
25
26     Rectangle {
27         anchors { fill: parent; margins: 6 }
28         color: "white"
29         opacity: 0.5
30         radius: 10
31         visible: mouseArea.pressed
32     }
33
34     Image {
35         id: icon
36         width: 30
37         height: 30
38         anchors.centerIn: parent
39         source: iconSource == "" ? "" : "../" + iconSource
40         sourceSize.width: width
41         sourceSize.height: height
42     }
43
44     MouseArea {
45         id: mouseArea
46
47         anchors.fill: parent
48         enabled: root.enabled
49         onClicked: parent.clicked()
50         onPressAndHold: parent.pressAndHold()
51     }
52 }