Aesthetic tweaks for qmleasing UI
[profile/ivi/qtdeclarative.git] / tools / qmleasing / Button.qml
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtQml module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.  For licensing terms and
14 ** conditions see http://qt.digia.com/licensing.  For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights.  These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file.  Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 import QtQuick 2.0
43
44 Item {
45     id: button
46
47     signal clicked
48
49     Rectangle {
50         id: normalBackground
51         radius: 4
52         anchors.fill: parent
53         smooth: true
54         gradient: Gradient {
55             GradientStop {
56                 position: 0
57                 color: "#afafaf"
58             }
59
60             GradientStop {
61                 position: 0.460
62                 color: "#808080"
63             }
64
65             GradientStop {
66                 position: 1
67                 color: "#adadad"
68             }
69         }
70         border.color: "#000000"
71     }
72
73
74     Rectangle {
75         id: hoveredBackground
76         x: 2
77         y: -8
78         radius: 4
79         opacity: 0
80         gradient: Gradient {
81             GradientStop {
82                 position: 0
83                 color: "#cacaca"
84             }
85
86             GradientStop {
87                 position: 0.460
88                 color: "#a2a2a2"
89             }
90
91             GradientStop {
92                 position: 1
93                 color: "#c8c8c8"
94             }
95         }
96         smooth: true
97         anchors.fill: parent
98         border.color: "#000000"
99     }
100
101
102     Rectangle {
103         id: pressedBackground
104         x: -8
105         y: 2
106         radius: 4
107         opacity: 0
108         gradient: Gradient {
109             GradientStop {
110                 position: 0
111                 color: "#8b8b8b"
112             }
113
114             GradientStop {
115                 position: 0.470
116                 color: "#626161"
117             }
118
119             GradientStop {
120                 position: 1
121                 color: "#8f8e8e"
122             }
123         }
124         smooth: true
125         anchors.fill: parent
126         border.color: "#000000"
127     }
128     states: [
129         State {
130             name: "hovered"
131
132             PropertyChanges {
133                 target: normalBackground
134                 opacity: 0
135             }
136
137             PropertyChanges {
138                 target: hoveredBackground
139                 opacity: 1
140             }
141         },
142         State {
143             name: "pressed"
144
145             PropertyChanges {
146                 target: normalBackground
147                 opacity: 0
148             }
149
150             PropertyChanges {
151                 target: pressedBackground
152                 opacity: 1
153             }
154         }
155     ]
156
157     Text {
158         color: "#e8e8e8"
159         text: qsTr("Play")
160         anchors.fill: parent
161         horizontalAlignment: Text.AlignHCenter
162         verticalAlignment: Text.AlignVCenter
163         font.bold: true
164         font.pixelSize: 20
165     }
166
167     MouseArea {
168         hoverEnabled: true
169         anchors.fill: parent
170         onEntered: button.state = "hovered"
171         onExited: button.state = ""
172         onClicked: {
173             button.state = "pressed"
174             button.clicked();
175         }
176     }
177 }