51 lines
1.5 KiB
QML
51 lines
1.5 KiB
QML
import QtQuick
|
|
import "."
|
|
|
|
// Selectable list row: solid accent fill + crust text when selected (not a
|
|
// soft tint), shared by CommandPalette and ClipboardManager so both
|
|
// launchers read as the same design language.
|
|
Rectangle {
|
|
id: row
|
|
|
|
property bool selected: false
|
|
property color accent: Theme.colors.primary
|
|
readonly property alias hovered: rowMouse.containsMouse
|
|
default property alias content: contentItem.data
|
|
|
|
signal clicked(var mouse)
|
|
signal entered()
|
|
|
|
height: 40
|
|
color: selected ? accent : (hovered ? Theme.colors.surfaceHover : "transparent")
|
|
border.width: selected ? Theme.geometry.borderWidth : 0
|
|
border.color: Theme.colors.crust
|
|
|
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
|
|
|
Rectangle {
|
|
width: 4
|
|
height: parent.height
|
|
anchors.left: parent.left
|
|
color: Theme.colors.crust
|
|
visible: row.selected
|
|
}
|
|
|
|
MouseArea {
|
|
id: rowMouse
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
onEntered: row.entered()
|
|
onClicked: (mouse) => row.clicked(mouse)
|
|
}
|
|
|
|
Item {
|
|
id: contentItem
|
|
anchors.fill: parent
|
|
anchors.leftMargin: Theme.geometry.padding + ((row.selected || row.hovered) ? 8 : 4)
|
|
anchors.rightMargin: Theme.geometry.padding
|
|
|
|
Behavior on anchors.leftMargin { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.Linear } }
|
|
}
|
|
}
|