1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
/*
* SPDX-FileCopyrightText: 2025 Akseli Lahtinen <akselmo@akselmo.dev>
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls as QQC2
import org.kde.kirigami as Kirigami
Kirigami.ApplicationWindow {
id: root
pageStack.initialPage: page
ListModel {
id: dragonModel
ListElement {
name: "Dragon Konqi"
title: "A very cool dragon"
}
ListElement {
name: "Dragon Kanqi"
title: "A very fierce dragon"
}
ListElement {
name: "Dragon Klinqli"
title: "A very chill dragon"
}
ListElement {
name: "Dragon Klynqi"
title: "A very sleepy dragon"
}
ListElement {
name: "Dragon Könqi"
title: "A very hungry dragon"
}
}
Component {
id: page
Kirigami.ScrollablePage {
title: "Here Be Dragons"
ListView {
model: dragonModel
anchors.fill: parent
delegate: QQC2.ItemDelegate {
id: itemDelegate
required property string name
required property string title
Kirigami.Theme.useAlternateBackgroundColor: true
width: parent.width
contentItem: Kirigami.TitleSubtitleWithActions {
title: itemDelegate.name
subtitle: itemDelegate.title
elide: Text.ElideRight
selected: itemDelegate.pressed || itemDelegate.highlighted
actions: [
Kirigami.Action {
icon.name: "edit-entry-symbolic"
text: "Modify dragon…"
onTriggered: console.warn("Hi!")
tooltip: text
},
Kirigami.Action {
icon.name: "edit-delete-remove-symbolic"
text: "Remove dragon…"
onTriggered: console.warn("Bye!")
tooltip: text
displayHint: Kirigami.DisplayHint.IconOnly
}
]
}
}
}
}
}
}
|