1.4 KiB · text History 905ae26
import QtQuick
import QtQuick.Layouts
import org.kde.plasma.components as PlasmaComponents3
import org.kde.kirigami as Kirigami

// A section's title in small caps with its count, as the Android app's
// headings; a collapsible one shows its arrow (the owner handles clicks).
PlasmaComponents3.ItemDelegate {
    id: heading

    property string count: ""
    property color countColor: Kirigami.Theme.disabledTextColor
    property bool collapsible: false
    property bool open: true

    hoverEnabled: collapsible
    topPadding: Kirigami.Units.smallSpacing
    bottomPadding: Kirigami.Units.smallSpacing

    background: Item {}

    contentItem: RowLayout {
        spacing: Kirigami.Units.smallSpacing

        Kirigami.Icon {
            visible: heading.collapsible
            source: heading.open ? "arrow-down" : "arrow-right"
            Layout.preferredWidth: Kirigami.Units.iconSizes.small
            Layout.preferredHeight: Kirigami.Units.iconSizes.small
        }

        PlasmaComponents3.Label {
            text: heading.text.toUpperCase()
            font.pixelSize: Kirigami.Theme.smallFont.pixelSize
            font.bold: true
            font.letterSpacing: 0.6
            color: Kirigami.Theme.highlightColor
        }

        PlasmaComponents3.Label {
            text: heading.count
            font: Kirigami.Theme.smallFont
            color: heading.countColor
        }

        Item { Layout.fillWidth: true }
    }
}