mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
new delegate for search applet
This commit is contained in:
parent
0eed8d3a90
commit
93e16a9ca1
1 changed files with 73 additions and 21 deletions
|
|
@ -84,29 +84,81 @@ Item {
|
||||||
focus: true
|
focus: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlasmaCore.IconItem {
|
Rectangle {
|
||||||
anchors {
|
|
||||||
bottom: parent.bottom
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
width: Math.min(parent.width, parent.height) * 0.8
|
|
||||||
height: width
|
|
||||||
opacity: 0.2
|
|
||||||
source: "search"
|
|
||||||
}
|
|
||||||
Controls.ScrollView {
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Milou.ResultsListView {
|
Kirigami.Theme.inherit: false
|
||||||
id: listView
|
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
||||||
queryString: queryField.text
|
color: Kirigami.Theme.BackgroundColor
|
||||||
highlight: null
|
PlasmaCore.IconItem {
|
||||||
PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.NormalColorGroup
|
anchors {
|
||||||
anchors.rightMargin: 10
|
bottom: parent.bottom
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
width: Math.min(parent.width, parent.height) * 0.8
|
||||||
|
height: width
|
||||||
|
opacity: 0.2
|
||||||
|
source: "search"
|
||||||
|
}
|
||||||
|
Controls.ScrollView {
|
||||||
|
anchors.fill: parent
|
||||||
|
Milou.ResultsListView {
|
||||||
|
id: listView
|
||||||
|
queryString: queryField.text
|
||||||
|
highlight: null
|
||||||
|
PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.NormalColorGroup
|
||||||
|
anchors.rightMargin: 10
|
||||||
|
|
||||||
onActivated: queryField.text = ""
|
onActivated: {
|
||||||
onUpdateQueryString: {
|
window.visible = false;
|
||||||
queryField.text = text
|
queryField.text = "";
|
||||||
queryField.cursorPosition = cursorPosition
|
}
|
||||||
|
onUpdateQueryString: {
|
||||||
|
queryField.text = text
|
||||||
|
queryField.cursorPosition = cursorPosition
|
||||||
|
}
|
||||||
|
delegate: Kirigami.BasicListItem {
|
||||||
|
id: resultDelegate
|
||||||
|
property var additionalActions: typeof actions !== "undefined" ? actions : []
|
||||||
|
icon: model.decoration
|
||||||
|
label: typeof modelData !== "undefined" ? modelData : model.display
|
||||||
|
subtitle: model.subtext || ""
|
||||||
|
onClicked: {
|
||||||
|
listView.currentIndex = model.index
|
||||||
|
listView.runCurrentIndex()
|
||||||
|
}
|
||||||
|
Row {
|
||||||
|
id: actionsRow
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: actionsRepeater
|
||||||
|
model: resultDelegate.additionalActions
|
||||||
|
|
||||||
|
Controls.ToolButton {
|
||||||
|
width: height
|
||||||
|
height: listItem.height
|
||||||
|
visible: modelData.visible || true
|
||||||
|
enabled: modelData.enabled || true
|
||||||
|
|
||||||
|
Accessible.role: Accessible.Button
|
||||||
|
Accessible.name: modelData.text
|
||||||
|
checkable: checked
|
||||||
|
checked: resultDelegate.activeAction === index
|
||||||
|
focus: resultDelegate.activeAction === index
|
||||||
|
|
||||||
|
Kirigami.Icon{
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: units.iconSizes.small
|
||||||
|
height: units.iconSizes.small
|
||||||
|
// ToolButton cannot cope with QIcon
|
||||||
|
source: modelData.icon || ""
|
||||||
|
active: parent.hovered || parent.checked
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: resultDelegate.ListView.view.runAction(index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue