Changeset View
Changeset View
Standalone View
Standalone View
src/qtquick/qml/private/entrygriddelegates/TileDelegate.qml
Show All 18 Lines | |||||
19 | * | 19 | * | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | import QtQuick 2.11 | 22 | import QtQuick 2.11 | ||
23 | import QtQuick.Controls 2.11 as QtControls | 23 | import QtQuick.Controls 2.11 as QtControls | ||
24 | import QtQuick.Layouts 1.11 as QtLayouts | 24 | import QtQuick.Layouts 1.11 as QtLayouts | ||
25 | import QtGraphicalEffects 1.11 as QtEffects | 25 | import QtGraphicalEffects 1.11 as QtEffects | ||
26 | 26 | | |||
27 | import org.kde.kirigami 2.7 as Kirigami | 27 | import org.kde.kirigami 2.12 as Kirigami | ||
28 | 28 | | |||
29 | import org.kde.newstuff 1.62 as NewStuff | 29 | import org.kde.newstuff 1.62 as NewStuff | ||
30 | 30 | | |||
31 | import ".." as Private | 31 | import ".." as Private | ||
32 | 32 | | |||
33 | Private.GridTileDelegate { | 33 | Private.GridTileDelegate { | ||
34 | id: component | 34 | id: component | ||
35 | property string useLabel | 35 | property string useLabel | ||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 105 | QtLayouts.GridLayout { | |||
107 | columns: 2 | 107 | columns: 2 | ||
108 | QtLayouts.ColumnLayout { | 108 | QtLayouts.ColumnLayout { | ||
109 | QtLayouts.Layout.minimumWidth: view.implicitCellWidth / 5 | 109 | QtLayouts.Layout.minimumWidth: view.implicitCellWidth / 5 | ||
110 | QtLayouts.Layout.maximumWidth: view.implicitCellWidth / 5 | 110 | QtLayouts.Layout.maximumWidth: view.implicitCellWidth / 5 | ||
111 | Item { | 111 | Item { | ||
112 | QtLayouts.Layout.fillWidth: true | 112 | QtLayouts.Layout.fillWidth: true | ||
113 | QtLayouts.Layout.minimumHeight: width | 113 | QtLayouts.Layout.minimumHeight: width | ||
114 | QtLayouts.Layout.maximumHeight: width | 114 | QtLayouts.Layout.maximumHeight: width | ||
115 | Kirigami.ShadowedRectangle { | ||||
116 | anchors.centerIn: tilePreview; | ||||
117 | width: Math.min(tilePreview.paintedWidth, tilePreview.width); | ||||
118 | height: Math.min(tilePreview.paintedHeight, tilePreview.height); | ||||
119 | Kirigami.Theme.colorSet: Kirigami.Theme.View | ||||
120 | shadow.size: Kirigami.Units.largeSpacing | ||||
121 | shadow.color: Qt.rgba(0, 0, 0, 0.3) | ||||
122 | } | ||||
115 | Image { | 123 | Image { | ||
broulik: `shadow.size` corresponds to the old `radius`, so you'd want to set `Kirigami.Units. | |||||
leinir: Less magic numbers are a nice thing ;) | |||||
116 | id: tilePreview | 124 | id: tilePreview | ||
#80 used in the old code is 128, i.e. 0.5 alpha, unless you want to make it look consistently with the shadows used elsewhere? broulik: `#80` used in the old code is 128, i.e. `0.5` alpha, unless you want to make it look… | |||||
leinir: Yeah, that was for consistency, but well spotted :) | |||||
117 | asynchronous: true; | 125 | asynchronous: true; | ||
118 | fillMode: Image.PreserveAspectFit; | 126 | fillMode: Image.PreserveAspectFit; | ||
119 | source: thumbnailAvailable ? model.previewsSmall[0] : ""; | 127 | source: thumbnailAvailable ? model.previewsSmall[0] : ""; | ||
120 | anchors { | 128 | anchors { | ||
121 | fill: parent | 129 | fill: parent | ||
122 | margins: Kirigami.Units.smallSpacing | 130 | margins: Kirigami.Units.smallSpacing | ||
123 | } | 131 | } | ||
124 | verticalAlignment: Image.AlignTop | 132 | verticalAlignment: Image.AlignTop | ||
125 | } | 133 | } | ||
126 | QtEffects.DropShadow { | | |||
127 | anchors.fill: tilePreview | | |||
128 | horizontalOffset: 0 | | |||
129 | verticalOffset: 0 | | |||
130 | radius: Kirigami.Units.largeSpacing | | |||
131 | samples: radius * 2 | | |||
132 | color: "#80000000" | | |||
133 | source: tilePreview | | |||
134 | } | | |||
135 | Kirigami.Icon { | 134 | Kirigami.Icon { | ||
136 | id: updateAvailableBadge; | 135 | id: updateAvailableBadge; | ||
137 | opacity: (model.status == NewStuff.ItemsModel.UpdateableStatus) ? 1 : 0; | 136 | opacity: (model.status == NewStuff.ItemsModel.UpdateableStatus) ? 1 : 0; | ||
138 | Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } } | 137 | Behavior on opacity { NumberAnimation { duration: Kirigami.Units.shortDuration; } } | ||
139 | anchors { | 138 | anchors { | ||
140 | top: parent.top; | 139 | top: parent.top; | ||
141 | left: parent.left; | 140 | left: parent.left; | ||
142 | margins: -Kirigami.Units.smallSpacing; | 141 | margins: -Kirigami.Units.smallSpacing; | ||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |
shadow.size corresponds to the old radius, so you'd want to set Kirigami.Units.largeSpacing here