Files
skygqts/app-carousel/AppButton.qml
T
2026-09-11 14:43:36 -04:00

52 lines
1.4 KiB
QML

import QtQuick
import Quickshell
import QtQuick.Layouts
Rectangle {
id: root
required property var theme
required property var 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
sourceSize.width: root.app.isIcon ? root.app.dims[0] : undefined
sourceSize.height: root.app.isIcon ? root.app.dims[1] : undefined
}
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()
}
}