First integration of new HMI design
[staging/HomeScreen.git] / HomeScreen / qml / ShortcutIcon.qml
1 /*
2  * Copyright (C) 2016 The Qt Company Ltd.
3  * Copyright (C) 2016 Mentor Graphics Development (Deutschland) GmbH
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 import QtQuick 2.2
19
20 MouseArea {
21     id: root
22     width: 195
23     height: 216.8
24     property string name: 'Home'
25     property bool active: false
26     Image {
27         id: icon
28         anchors.fill: parent
29         source: './images/Shortcut/HMI_Shortcut_%1-01.png'.arg(root.name)
30     }
31     Image {
32         anchors.fill: parent
33         source: './images/Shortcut/HMI_Shortcut_%1_Active-01.png'.arg(root.name)
34         opacity: 1.0 - icon.opacity
35     }
36     states: [
37         State {
38             when: root.active
39             PropertyChanges {
40                 target: icon
41                 opacity: 0.0
42             }
43         }
44     ]
45
46     transitions: [
47         Transition {
48             NumberAnimation {
49                 properties: 'opacity'
50                 easing.type: Easing.OutExpo
51             }
52         }
53     ]
54 }