Kirigami2

MobileDialogLayer.qml
1/*
2 * SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7import QtQuick
8import QtQuick.Controls as QQC2
9import QtQuick.Layouts
10import org.kde.kirigami as Kirigami
11
12Kirigami.Dialog {
13 id: dialog
14
15 clip: true
16 modal: true
17
18 topPadding: 0
19 leftPadding: 0
20 rightPadding: 0
21 bottomPadding: 0
22
23 header: Kirigami.AbstractApplicationHeader {
24 pageRow: null
25 page: null
26
27 minimumHeight: Kirigami.Units.gridUnit * 1.6
28 maximumHeight: Kirigami.Units.gridUnit * 1.6
29 preferredHeight: Kirigami.Units.gridUnit * 1.6
30
31 Keys.onEscapePressed: event => {
32 if (dialog.opened) {
33 dialog.close();
34 } else {
35 event.accepted = false;
36 }
37 }
38
39 contentItem: RowLayout {
40 width: parent.width
41 Kirigami.Heading {
42 Layout.leftMargin: Kirigami.Units.largeSpacing
43 text: dialog.title
44 elide: Text.ElideRight
45 }
46 Item {
47 Layout.fillWidth: true
48 }
49 Kirigami.Icon {
50 id: closeIcon
51 Layout.alignment: Qt.AlignVCenter
52 Layout.rightMargin: Kirigami.Units.largeSpacing
53 Layout.preferredHeight: Kirigami.Units.iconSizes.smallMedium
54 Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium
55 source: closeMouseArea.containsMouse ? "window-close" : "window-close-symbolic"
56 active: closeMouseArea.containsMouse
57 MouseArea {
58 id: closeMouseArea
59 hoverEnabled: true
60 anchors.fill: parent
61 onClicked: mouse => dialog.close();
62 }
63 }
64 }
65 }
66
67 contentItem: QQC2.Control {
68 topPadding: 0
69 leftPadding: 0
70 rightPadding: 0
71 bottomPadding: 0
72 }
73}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:52 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.