Unity 8
 All Classes Functions Properties
PreviewImageGallery.qml
1 /*
2  * Copyright (C) 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 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 import "../../Components"
19 
25  id: root
26  implicitHeight: units.gu(22)
27 
28  ListView {
29  id: previewImageListView
30  spacing: units.gu(1)
31  anchors.fill: parent
32  orientation: ListView.Horizontal
33  cacheBuffer: width * 3
34  model: root.widgetData["sources"]
35  clip: true
36 
37  // FIXME: Because of ListViews inside ListViews inside Flickables inside ListViews (and some more)
38  // we finally reached the point where this ListView doesn't correctly get swipe input any more but
39  // instead the parent ListView is the one that is swiped. This MouseArea sort of creates a blocking
40  // layer to make sure this ListView can be swiped, regardless of what's behind it.
41  MouseArea {
42  anchors.fill: parent
43  enabled: parent.contentWidth > parent.width
44  }
45 
46  // FIXME: Because of ListViews inside ListViews inside Flickables inside ListViews (and some more)
47  // we finally reached the point where this ListView doesn't correctly get swipe input any more but
48  // instead the parent ListView is the one that is swiped. This MouseArea sort of creates a blocking
49  // layer to make sure this ListView can be swiped, regardless of what's behind it.
50  MouseArea {
51  anchors.fill: parent
52  enabled: parent.contentWidth > parent.width
53  }
54 
55  LazyImage {
56  objectName: "placeholderScreenshot"
57  anchors {
58  top: parent.top
59  bottom: parent.bottom
60  }
61  scaleTo: "height"
62  source: "broken_image"
63  initialWidth: units.gu(13)
64  visible: previewImageListView.count == 0
65  }
66 
67  delegate: LazyImage {
68  anchors {
69  top: parent.top
70  bottom: parent.bottom
71  }
72  source: modelData ? modelData : ""
73  scaleTo: "height"
74  initialWidth: units.gu(13)
75  }
76  }
77 }
var widgetData
Variable used to contain widget's data.