mirror of
https://invent.kde.org/marcoa/a-la-karte.git
synced 2026-02-09 21:13:08 +00:00
54 lines
1.3 KiB
QML
54 lines
1.3 KiB
QML
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||
|
|
// SPDX-FileCopyrightText: 2024 A-La-Karte Contributors
|
||
|
|
|
||
|
|
import QtQuick
|
||
|
|
import QtQuick.Controls as QQC2
|
||
|
|
import org.kde.kirigami as Kirigami
|
||
|
|
|
||
|
|
FocusScope {
|
||
|
|
id: root
|
||
|
|
|
||
|
|
property alias contentItem: container.contentItem
|
||
|
|
property bool highlighted: activeFocus
|
||
|
|
|
||
|
|
signal activated()
|
||
|
|
|
||
|
|
Kirigami.ShadowedRectangle {
|
||
|
|
id: container
|
||
|
|
anchors.fill: parent
|
||
|
|
|
||
|
|
radius: Kirigami.Units.mediumSpacing
|
||
|
|
color: Kirigami.Theme.backgroundColor
|
||
|
|
|
||
|
|
border.width: root.highlighted ? 2 : 0
|
||
|
|
border.color: Kirigami.Theme.highlightColor
|
||
|
|
|
||
|
|
shadow {
|
||
|
|
size: root.highlighted ? Kirigami.Units.largeSpacing : Kirigami.Units.smallSpacing
|
||
|
|
color: Qt.rgba(0, 0, 0, 0.2)
|
||
|
|
}
|
||
|
|
|
||
|
|
scale: root.highlighted ? 1.02 : 1.0
|
||
|
|
|
||
|
|
Behavior on scale {
|
||
|
|
NumberAnimation { duration: Kirigami.Units.shortDuration }
|
||
|
|
}
|
||
|
|
|
||
|
|
Behavior on shadow.size {
|
||
|
|
NumberAnimation { duration: Kirigami.Units.shortDuration }
|
||
|
|
}
|
||
|
|
|
||
|
|
property Item contentItem
|
||
|
|
|
||
|
|
data: [contentItem]
|
||
|
|
}
|
||
|
|
|
||
|
|
Keys.onReturnPressed: root.activated()
|
||
|
|
Keys.onEnterPressed: root.activated()
|
||
|
|
Keys.onSpacePressed: root.activated()
|
||
|
|
|
||
|
|
Accessible.role: Accessible.Button
|
||
|
|
Accessible.name: ""
|
||
|
|
Accessible.onPressAction: root.activated()
|
||
|
|
}
|