From 59dde1003d900e117ef4e6dc1ae7b8d89ce8370b Mon Sep 17 00:00:00 2001 From: Alex Spataru Date: Sat, 16 Nov 2024 16:06:54 -0500 Subject: [PATCH] Make legends box scrollable --- app/qml/Widgets/Dashboard/MultiPlot.qml | 55 +++++++++++++++---------- 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/app/qml/Widgets/Dashboard/MultiPlot.qml b/app/qml/Widgets/Dashboard/MultiPlot.qml index ee2df79e..c53315a7 100644 --- a/app/qml/Widgets/Dashboard/MultiPlot.qml +++ b/app/qml/Widgets/Dashboard/MultiPlot.qml @@ -96,38 +96,49 @@ Item { Rectangle { width: parent.width anchors.centerIn: parent - height: _legends.implicitHeight + 8 + height: Math.min(_legends.implicitHeight + 8, parent.height) border.width: 1 color: Cpp_ThemeManager.colors["widget_base"] border.color: Cpp_ThemeManager.colors["widget_border"] - ColumnLayout { - id: _legends - spacing: 4 + Flickable { + clip: true anchors.margins: 4 + contentWidth: width anchors.fill: parent + contentHeight: _legends.implicitHeight - Repeater { - model: root.model.count - delegate: RowLayout { - id: _label - spacing: 4 - Layout.fillWidth: true + ScrollBar.vertical: ScrollBar { + id: scroll + } - Rectangle { - width: 14 - height: 14 - color: root.model.colors[index] - Layout.alignment: Qt.AlignVCenter - } + ColumnLayout { + id: _legends + spacing: 4 + width: parent.width - Label { - elide: Qt.ElideMiddle - text: root.model.labels[index] - Layout.alignment: Qt.AlignVCenter - font: Cpp_Misc_CommonFonts.customMonoFont(0.8) - Layout.maximumWidth: 128 - 14 - 8 + Repeater { + model: root.model.count + delegate: RowLayout { + id: _label + spacing: 4 + Layout.fillWidth: true + + Rectangle { + width: 14 + height: 14 + color: root.model.colors[index] + Layout.alignment: Qt.AlignVCenter + } + + Label { + elide: Qt.ElideMiddle + text: root.model.labels[index] + Layout.alignment: Qt.AlignVCenter + font: Cpp_Misc_CommonFonts.customMonoFont(0.8) + Layout.maximumWidth: 128 - 14 - 8 + } } } }