KNewStuff
12import org.kde.kirigami as Kirigami
16 property alias screenshotsModel: screenshotsRep.model
17 readonly property alias count: screenshotsRep.count
18 property int currentIndex: -1
19 property Item currentItem: screenshotsRep.itemAt(currentIndex)
20 Layout.preferredHeight: Kirigami.Units.gridUnit * 13
22 contentWidth: screenshotsLayout.width
26 parent: applicationWindow().Overlay.overlay
30 x: (parent.width - width)/2
31 y: (parent.height - height)/2
32 readonly property real proportion: overlayImage.sourceSize.width>1 ? overlayImage.sourceSize.height/overlayImage.sourceSize.width : 1
33 height: overlayImage.status == Image.Loading ? Kirigami.Units.gridUnit * 5 : Math.min(parent.height * 0.9, (parent.width * 0.9) * proportion, overlayImage.sourceSize.height)
34 width: height/proportion
39 running: overlayImage.status == Image.Loading
47 source: root.currentItem ? root.currentItem.imageSource : ""
48 fillMode: Image.PreserveAspectFit
55 verticalCenter: parent.verticalCenter
58 visible: leftAction.visible
64 verticalCenter: parent.verticalCenter
67 visible: rightAction.visible
73 enabled: overlay.visible && visible
74 visible: root.currentIndex >= 1 && !indicator.running
75 onTriggered: root.currentIndex = (root.currentIndex - 1) % root.count
81 enabled: overlay.visible && visible
82 visible: root.currentIndex < (root.count - 1) && !indicator.running
83 onTriggered: root.currentIndex = (root.currentIndex + 1) % root.count
89 height: root.contentHeight
90 spacing: Kirigami.Units.largeSpacing
93 focus: overlay.visible
95 Keys.onLeftPressed: if (leftAction.visible) leftAction.trigger()
96 Keys.onRightPressed: if (rightAction.visible) rightAction.trigger()
101 delegate: MouseArea {
102 readonly property url imageSource: modelData
103 readonly property real proportion: thumbnail.sourceSize.width>1 ? thumbnail.sourceSize.height/thumbnail.sourceSize.width : 1
104 anchors.verticalCenter: parent.verticalCenter
105 width: Math.max(50, height/proportion)
106 height: screenshotsLayout.height - 2 * Kirigami.Units.largeSpacing
109 cursorShape: Qt.PointingHandCursor
112 root.currentIndex = index
116 Kirigami.ShadowedRectangle {
117 visible: thumbnail.status == Image.Ready
118 anchors.fill: thumbnail
119 Kirigami.Theme.colorSet: Kirigami.Theme.View
120 shadow.size: Kirigami.Units.largeSpacing
121 shadow.color: Qt.rgba(0, 0, 0, 0.3)
126 running: thumbnail.status == Image.Loading
127 anchors.centerIn: parent
133 height: parent.height
134 fillMode: Image.PreserveAspectFit
141 readonly property var leftShadow: Shadow {
146 bottom: parent.bottom
149 width: Math.max(0, Math.min(root.width/5, root.contentX))
152 readonly property var rightShadow: Shadow {
157 bottom: parent.bottom
160 width: Math.max(0, Math.min(root.contentWidth - root.contentX - root.width)/5)
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:21:35 by
doxygen 1.10.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.