Unity 8
 All Classes Functions Properties
SpreadDelegate.qml
1 /*
2  * Copyright 2014 Canonical Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authors: Michael Zanetti <michael.zanetti@canonical.com>
17 */
18 
19 import QtQuick 2.0
20 
21 Item {
22  id: root
23 
24  signal clicked()
25 
26  property real topMarginProgress
27 
28  QtObject {
29  id: priv
30  property real heightDifference: root.height - appImage.implicitHeight
31  }
32 
33  Image {
34  id: dropShadow
35  anchors.fill: appImage
36  anchors.margins: -units.gu(2)
37  source: "graphics/dropshadow.png"
38  opacity: .4
39  }
40  Image {
41  id: appImage
42  anchors {
43  left: parent.left;
44  bottom: parent.bottom;
45  top: parent.top;
46  topMargin: priv.heightDifference * Math.max(0, 1 - root.topMarginProgress)
47  }
48  source: model.screenshot
49  antialiasing: true
50  }
51  MouseArea {
52  anchors.fill: appImage
53  onClicked: root.clicked()
54  }
55 }