Kirigami-addons

KQuickCommandBarPage.qml
1// SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
2// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
3
4import QtQuick
5import QtQuick.Controls as QQC2
6import QtQuick.Layouts
7import org.kde.kirigami as Kirigami
8import org.kde.kirigamiaddons.delegates as Delegates
9import org.kde.kirigamiaddons.components as Components
10import org.kde.kirigamiaddons.statefulapp as StatefulApp
11import QtQuick.Templates as T
12
13Kirigami.SearchDialog {
14 id: root
15
16 required property StatefulApp.AbstractKirigamiApplication application
17
18 background: Components.DialogRoundedBackground {}
19
20 onTextChanged: root.application.actionsModel.filterString = text
21
22 model: root.application.actionsModel
23 delegate: Delegates.RoundedItemDelegate {
24 id: commandDelegate
25
26 required property int index
27 required property string decoration
28 required property string displayName
29 required property string shortcut
30 required property var qaction
31
32 icon.name: decoration
33 text: displayName
34
35 contentItem: RowLayout {
36 spacing: Kirigami.Units.smallSpacing
37
38 Delegates.DefaultContentItem {
39 itemDelegate: commandDelegate
40 Layout.fillWidth: true
41 }
42
43 QQC2.Label {
44 text: commandDelegate.shortcut
45 color: Kirigami.Theme.disabledTextColor
46 }
47 }
48
49 onClicked: {
50 qaction.trigger()
51 root.close()
52 }
53 }
54
55 emptyText: i18ndc("kirigami-addons6", "@info:placeholder", "No results found")
56}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:03:50 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.