From bad6e08cee23cdb69accb83c00d58ceb3ecf66d6 Mon Sep 17 00:00:00 2001 From: milonekrone Date: Wed, 14 Jan 2026 16:03:04 +0100 Subject: [PATCH] Add qml/VerticalList.qml --- qml/VerticalList.qml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 qml/VerticalList.qml diff --git a/qml/VerticalList.qml b/qml/VerticalList.qml new file mode 100644 index 0000000..cf45112 --- /dev/null +++ b/qml/VerticalList.qml @@ -0,0 +1,39 @@ +import QtQuick +import QtQuick.Controls + +Item { + id: vl + property var itemsModel: [] + property int currentIndex: 0 + signal activated(int idx) + signal triggered(var entryObj) + + readonly property int count: lv.count + + function positionViewAtIndex(i, mode) { lv.positionViewAtIndex(i, mode) } + function triggerCurrent() { + if (lv.currentItem && lv.currentItem.entryObj) triggered(lv.currentItem.entryObj) + } + + ListView { + id: lv + anchors.fill: parent + model: vl.itemsModel + spacing: 10 + currentIndex: vl.currentIndex + clip: true + boundsBehavior: Flickable.StopAtBounds + + delegate: XmbItemDelegate { + width: lv.width + entryObj: modelData + focused: (index === lv.currentIndex) + onClicked: { + vl.activated(index) + vl.triggered(entryObj) + } + } + + onCurrentIndexChanged: vl.activated(currentIndex) + } +}