Changeset View
Changeset View
Standalone View
Standalone View
src/qmlcontrols/kcmcontrols/qml/GridDelegate.qml
Show All 16 Lines | |||||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | import QtQuick 2.8 | 19 | import QtQuick 2.8 | ||
20 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 | ||
21 | import QtQuick.Controls 2.2 as Controls | 21 | import QtQuick.Controls 2.2 as Controls | ||
22 | import QtQuick.Templates 2.2 as T2 | 22 | import QtQuick.Templates 2.2 as T2 | ||
23 | import QtGraphicalEffects 1.0 | 23 | import QtGraphicalEffects 1.0 | ||
24 | 24 | | |||
25 | import org.kde.kirigami 2.2 as Kirigami | 25 | import org.kde.kirigami 2.12 as Kirigami | ||
26 | 26 | | |||
27 | /** | 27 | /** | ||
28 | * Base delegate for KControlmodules based on Grid views of thumbnails | 28 | * Base delegate for KControlmodules based on Grid views of thumbnails | ||
29 | * Use the onClicked signal handler for managing the main action when | 29 | * Use the onClicked signal handler for managing the main action when | ||
30 | * the user clicks on the thumbnail | 30 | * the user clicks on the thumbnail | ||
31 | * @inherits QtQuick.Templates.ItemDelegate | 31 | * @inherits QtQuick.Templates.ItemDelegate | ||
32 | */ | 32 | */ | ||
33 | T2.ItemDelegate { | 33 | T2.ItemDelegate { | ||
Show All 31 Lines | |||||
65 | * icons on the bottom-right corner of the thumbnail on mouse over | 65 | * icons on the bottom-right corner of the thumbnail on mouse over | ||
66 | */ | 66 | */ | ||
67 | property list<QtObject> actions | 67 | property list<QtObject> actions | ||
68 | 68 | | |||
69 | width: GridView.view.cellWidth | 69 | width: GridView.view.cellWidth | ||
70 | height: GridView.view.cellHeight | 70 | height: GridView.view.cellHeight | ||
71 | hoverEnabled: true | 71 | hoverEnabled: true | ||
72 | 72 | | |||
73 | Rectangle { | 73 | Kirigami.ShadowedRectangle { | ||
74 | id: thumbnail | 74 | id: thumbnail | ||
75 | anchors { | 75 | anchors { | ||
76 | centerIn: parent | 76 | centerIn: parent | ||
77 | verticalCenterOffset: Math.ceil(-labelLayout.height/2) | 77 | verticalCenterOffset: Math.ceil(-labelLayout.height/2) | ||
78 | } | 78 | } | ||
79 | width: Kirigami.Settings.isMobile ? delegate.width - Kirigami.Units.gridUnit : Math.min(delegate.GridView.view.implicitCellWidth, delegate.width - Kirigami.Units.gridUnit) | 79 | width: Kirigami.Settings.isMobile ? delegate.width - Kirigami.Units.gridUnit : Math.min(delegate.GridView.view.implicitCellWidth, delegate.width - Kirigami.Units.gridUnit) | ||
80 | height: Kirigami.Settings.isMobile ? Math.round((delegate.width - Kirigami.Units.gridUnit) / 1.6) | 80 | height: Kirigami.Settings.isMobile ? Math.round((delegate.width - Kirigami.Units.gridUnit) / 1.6) | ||
81 | : Math.min(delegate.GridView.view.implicitCellHeight - Kirigami.Units.gridUnit * 3, | 81 | : Math.min(delegate.GridView.view.implicitCellHeight - Kirigami.Units.gridUnit * 3, | ||
82 | delegate.height - Kirigami.Units.gridUnit) | 82 | delegate.height - Kirigami.Units.gridUnit) | ||
83 | radius: Kirigami.Units.smallSpacing | 83 | radius: Kirigami.Units.smallSpacing | ||
84 | Kirigami.Theme.inherit: false | 84 | Kirigami.Theme.inherit: false | ||
85 | Kirigami.Theme.colorSet: Kirigami.Theme.View | 85 | Kirigami.Theme.colorSet: Kirigami.Theme.View | ||
86 | 86 | | |||
87 | shadow.xOffset: 0 | ||||
88 | shadow.yOffset: 2 | ||||
89 | shadow.size: 10 | ||||
90 | shadow.color: Qt.rgba(0, 0, 0, 0.3) | ||||
91 | | ||||
87 | color: { | 92 | color: { | ||
88 | if (delegate.GridView.isCurrentItem) { | 93 | if (delegate.GridView.isCurrentItem) { | ||
89 | return Kirigami.Theme.highlightColor; | 94 | return Kirigami.Theme.highlightColor; | ||
90 | } else if (parent.hovered) { | 95 | } else if (parent.hovered) { | ||
91 | return Kirigami.Theme.highlightColor; | 96 | return Kirigami.Theme.highlightColor; | ||
92 | } else { | 97 | } else { | ||
93 | return Kirigami.Theme.backgroundColor; | 98 | return Kirigami.Theme.backgroundColor; | ||
94 | } | 99 | } | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 157 | delegate: Controls.Button { | |||
160 | Controls.ToolTip.timeout: 5000 | 165 | Controls.ToolTip.timeout: 5000 | ||
161 | Controls.ToolTip.visible: (Kirigami.Settings.isMobile ? pressed : hovered) && modelData.tooltip.length > 0 | 166 | Controls.ToolTip.visible: (Kirigami.Settings.isMobile ? pressed : hovered) && modelData.tooltip.length > 0 | ||
162 | Controls.ToolTip.text: modelData.tooltip | 167 | Controls.ToolTip.text: modelData.tooltip | ||
163 | } | 168 | } | ||
164 | } | 169 | } | ||
165 | } | 170 | } | ||
166 | } | 171 | } | ||
167 | } | 172 | } | ||
168 | // Bug 397367: explicitly using "delegate" as otherwise it crashes when switching between KCMs | | |||
169 | layer.enabled: delegate.GraphicsInfo.api === GraphicsInfo.OpenGL | | |||
170 | layer.effect: DropShadow { | | |||
171 | horizontalOffset: 0 | | |||
172 | verticalOffset: 2 | | |||
173 | radius: 10 | | |||
174 | samples: 32 | | |||
175 | color: Qt.rgba(0, 0, 0, 0.3) | | |||
176 | } | | |||
177 | } | 173 | } | ||
178 | 174 | | |||
179 | ColumnLayout { | 175 | ColumnLayout { | ||
180 | id: labelLayout | 176 | id: labelLayout | ||
181 | spacing: 0 | 177 | spacing: 0 | ||
182 | anchors { | 178 | anchors { | ||
183 | left: thumbnail.left | 179 | left: thumbnail.left | ||
184 | right: thumbnail.right | 180 | right: thumbnail.right | ||
Show All 31 Lines |