50 lines
1.2 KiB
QML
50 lines
1.2 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import QtQuick.Layouts
|
|
|
|
Rectangle {
|
|
id: root
|
|
|
|
required property var theme
|
|
required property App app
|
|
required property bool selected
|
|
|
|
signal activated()
|
|
|
|
width: theme.cardWidth
|
|
height: theme.cardHeight
|
|
radius: theme.cornerRadius
|
|
color: theme.cardBg
|
|
border.width: selected ? 3 : 1
|
|
border.color: selected ? theme.selectedBorder : theme.cardBorder
|
|
clip: true
|
|
|
|
ColumnLayout {
|
|
spacing: 10
|
|
width: root.theme.cardWidth
|
|
height: root.theme.cardHeight
|
|
anchors.fill: parent
|
|
anchors.margins: root.theme.cardPadding
|
|
Image {
|
|
fillMode: Image.PreserveAspectFit
|
|
Layout.alignment: Qt.AlignCenter
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
source: root.app.isIcon ? Quickshell.iconPath(root.app.image) : root.app.image
|
|
}
|
|
Text {
|
|
id: label
|
|
elide: Text.ElideRight
|
|
color: root.theme.textColor
|
|
text: root.app.name
|
|
font.pixelSize: root.theme.fontSize
|
|
Layout.alignment: Qt.AlignHCenter
|
|
}
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: root.activated()
|
|
}
|
|
}
|