Files
Panama/config/dot/quickshell/modules/quicksettings/ScrollColumn.qml
T

43 lines
1.2 KiB
QML

// A column that grows to fit its contents up to `maxHeight`, then scrolls.
// Used by every detail list in the panel so they all overflow the same way.
import QtQuick
import qs.config
Item {
id: root
property int maxHeight: 300
property alias spacing: column.spacing
default property alias content: column.data
implicitHeight: Math.min(column.implicitHeight, root.maxHeight)
Flickable {
id: flick
anchors.fill: parent
contentHeight: column.implicitHeight
clip: true
boundsBehavior: Flickable.StopAtBounds
Column {
id: column
width: flick.width
spacing: 2
}
}
// Static indicator — no fade timers, nothing repainting while idle. It is
// only there so a clipped list doesn't look like the whole list.
Rectangle {
anchors.right: parent.right
width: 3
radius: 1.5
border.width: 0
color: Theme.alpha(Theme.fg, 0.25)
visible: flick.contentHeight > flick.height + 1
height: Math.max(24, flick.height * (flick.height / Math.max(1, flick.contentHeight)))
y: (flick.height - height) * (flick.contentY / Math.max(1, flick.contentHeight - flick.height))
}
}