mirror of
https://invent.kde.org/marcoa/a-la-karte.git
synced 2026-02-09 21:13:08 +00:00
55 lines
1.5 KiB
QML
55 lines
1.5 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 QtQuick.Layouts
|
||
|
|
import org.kde.kirigami as Kirigami
|
||
|
|
|
||
|
|
ColumnLayout {
|
||
|
|
id: emptyState
|
||
|
|
|
||
|
|
property string icon: "applications-games"
|
||
|
|
property string title: ""
|
||
|
|
property string description: ""
|
||
|
|
property string actionText: ""
|
||
|
|
|
||
|
|
signal actionTriggered()
|
||
|
|
|
||
|
|
spacing: Kirigami.Units.largeSpacing
|
||
|
|
width: parent ? Math.min(parent.width - Kirigami.Units.gridUnit * 4, Kirigami.Units.gridUnit * 20) : Kirigami.Units.gridUnit * 20
|
||
|
|
|
||
|
|
Kirigami.Icon {
|
||
|
|
source: emptyState.icon
|
||
|
|
Layout.preferredWidth: Kirigami.Units.iconSizes.enormous
|
||
|
|
Layout.preferredHeight: Kirigami.Units.iconSizes.enormous
|
||
|
|
Layout.alignment: Qt.AlignHCenter
|
||
|
|
opacity: 0.5
|
||
|
|
}
|
||
|
|
|
||
|
|
Kirigami.Heading {
|
||
|
|
text: emptyState.title
|
||
|
|
level: 2
|
||
|
|
horizontalAlignment: Text.AlignHCenter
|
||
|
|
wrapMode: Text.WordWrap
|
||
|
|
Layout.fillWidth: true
|
||
|
|
}
|
||
|
|
|
||
|
|
QQC2.Label {
|
||
|
|
text: emptyState.description
|
||
|
|
horizontalAlignment: Text.AlignHCenter
|
||
|
|
wrapMode: Text.WordWrap
|
||
|
|
color: Kirigami.Theme.disabledTextColor
|
||
|
|
Layout.fillWidth: true
|
||
|
|
visible: text.length > 0
|
||
|
|
}
|
||
|
|
|
||
|
|
QQC2.Button {
|
||
|
|
text: emptyState.actionText
|
||
|
|
icon.name: "document-import"
|
||
|
|
Layout.alignment: Qt.AlignHCenter
|
||
|
|
visible: emptyState.actionText.length > 0
|
||
|
|
onClicked: emptyState.actionTriggered()
|
||
|
|
}
|
||
|
|
}
|