Changeset View
Changeset View
Standalone View
Standalone View
src/controls/AbstractCard.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2018 Marco Martin <mart@kde.org> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU Library General Public License as | ||||
6 | * published by the Free Software Foundation; either version 2, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU Library General Public License for more details | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Library General Public | ||||
15 | * License along with this program; if not, write to the | ||||
16 | * Free Software Foundation, Inc., | ||||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | import QtQuick 2.6 | ||||
21 | import QtGraphicalEffects 1.0 | ||||
22 | import org.kde.kirigami 2.3 as Kirigami | ||||
23 | import "templates" as T | ||||
24 | | ||||
25 | /** | ||||
26 | * A AbstractCard is the base for cards. A Card is a visual object that serves | ||||
27 | * as an entry point for more detailed information. An abstractCard is empty, | ||||
28 | * providing just the look and the base properties and signals for an ItemDelegate. | ||||
29 | * It can be filled with any custom layout of items, its content is organized | ||||
30 | * in 3 properties: header, contentItem and footer. | ||||
31 | * Use this only when you need particular custom contents, for a standard layout | ||||
32 | * for cards, use the Card component. | ||||
33 | * | ||||
34 | * @see Card | ||||
35 | * @inherits T.AbstractCard | ||||
36 | * @since 2.4 | ||||
37 | */ | ||||
38 | T.AbstractCard { | ||||
39 | id: root | ||||
40 | | ||||
41 | background: Rectangle { | ||||
42 | color: Kirigami.Theme.backgroundColor | ||||
43 | Rectangle { | ||||
44 | anchors.fill: parent | ||||
45 | color: Kirigami.Theme.highlightColor | ||||
46 | opacity: { | ||||
47 | if (root.showClickFeedback) { | ||||
48 | return root.down ? 0.3 : (root.hovered ? 0.1 : 0); | ||||
49 | } else { | ||||
50 | return 0; | ||||
51 | } | ||||
52 | } | ||||
53 | Behavior on opacity { | ||||
54 | OpacityAnimator { | ||||
55 | duration: Kirigami.Units.longDuration | ||||
56 | easing.type: Easing.InOutQuad | ||||
57 | } | ||||
58 | } | ||||
59 | } | ||||
60 | layer.enabled: true | ||||
61 | layer.effect: DropShadow { | ||||
62 | horizontalOffset: 0 | ||||
63 | verticalOffset: 1 | ||||
64 | radius: 12 | ||||
65 | samples: 32 | ||||
66 | color: Qt.rgba(0, 0, 0, 0.5) | ||||
67 | } | ||||
68 | } | ||||
69 | } |