Unity 8
 All Classes Functions Properties
CloseIcon.qml
1 /*
2  * Copyright (C) 2013 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 import QtQuick 2.0
18 
19 Item {
20  id: root
21 
22  Image {
23  id: closeIcon
24  anchors.centerIn: parent
25  source: "graphics/close_btn.png"
26 
27  state: (root.enabled) ? "shown" : "hidden"
28 
29  states: [
30  State {
31  name: "shown"
32  PropertyChanges {
33  target: closeIcon
34  height: root.height
35  width: root.width
36  }
37  },
38  State {
39  name: "hidden"
40  PropertyChanges {
41  target: closeIcon
42  height: 0
43  width: 0
44  }
45  }
46 
47  ]
48  transitions: [
49  Transition {
50  to: "shown"
51  NumberAnimation {
52  properties: "width, height"; duration: 300
53  easing { type: Easing.OutBack; overshoot: 5 }
54  }
55  },
56  Transition {
57  to: "hidden"
58  NumberAnimation { properties: "width, height"; duration: 250; }
59  }
60  ]
61  }
62 }