Kirigami2

styles/Material/InlineMessage.qml
1/*
2 * SPDX-FileCopyrightText: 2018 Eike Hein <hein@kde.org>
3 * SPDX-FileCopyrightText: 2018 Marco Martin <mart@kde.org>
4 * SPDX-FileCopyrightText: 2018 Kai Uwe Broulik <kde@privat.broulik.de>
5 *
6 * SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8
9import QtQuick
10import org.kde.kirigami as Kirigami
11import org.kde.kirigami.templates as KT
12
13KT.InlineMessage {
14 id: root
15
16 // a rectangle padded with anchors.margins is used to simulate a border
17 padding: bgFillRect.anchors.margins + Kirigami.Units.smallSpacing
18
19 background: Kirigami.ShadowedRectangle {
20 id: bgBorderRect
21
22 color: switch (root.type) {
23 case Kirigami.MessageType.Positive: return Kirigami.Theme.positiveTextColor;
24 case Kirigami.MessageType.Warning: return Kirigami.Theme.neutralTextColor;
25 case Kirigami.MessageType.Error: return Kirigami.Theme.negativeTextColor;
26 default: return Kirigami.Theme.activeTextColor;
27 }
28
29 radius: Kirigami.Units.cornerRadius
30 shadow.size: 12
31 shadow.xOffset: 0
32 shadow.yOffset: 1
33 shadow.color: Qt.rgba(0, 0, 0, 0.5)
34
35 Rectangle {
36 id: bgFillRect
37
38 anchors.fill: parent
39 anchors.margins: 1
40
41 color: Kirigami.Theme.backgroundColor
42
43 radius: bgBorderRect.radius
44 }
45
46 Rectangle {
47 anchors.fill: bgFillRect
48
49 color: bgBorderRect.color
50
51 opacity: 0.20
52
53 radius: bgFillRect.radius
54 }
55 }
56}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Nov 17 2024 19:26:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.