From d73abb493e2bae81938432da3a4909db77395905 Mon Sep 17 00:00:00 2001 From: Jared Van Bortel Date: Mon, 24 Feb 2025 14:00:03 -0500 Subject: [PATCH] add scrolling to standard MyComboBox to prevent Mistral clipping Signed-off-by: Jared Van Bortel --- gpt4all-chat/qml/MyComboBox.qml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/gpt4all-chat/qml/MyComboBox.qml b/gpt4all-chat/qml/MyComboBox.qml index 0e8c5aa3..9c23a57c 100644 --- a/gpt4all-chat/qml/MyComboBox.qml +++ b/gpt4all-chat/qml/MyComboBox.qml @@ -60,27 +60,28 @@ ComboBox { highlighted: comboBox.highlightedIndex === index } popup: Popup { - // FIXME This should be made much nicer to take into account lists that are very long so - // that it is scrollable and also sized optimally taking into account the x,y and the content - // width and height as well as the window width and height y: comboBox.height - 1 width: comboBox.width - implicitHeight: contentItem.implicitHeight + 20 + implicitHeight: Math.min(window.height - y, contentItem.implicitHeight + 20) padding: 0 - contentItem: Rectangle { - implicitWidth: myListView.contentWidth + implicitWidth: comboBox.width implicitHeight: myListView.contentHeight color: "transparent" - ListView { - id: myListView + radius: 10 + ScrollView { anchors.fill: parent anchors.margins: 10 clip: true - implicitHeight: contentHeight - model: comboBox.popup.visible ? comboBox.delegateModel : null - currentIndex: comboBox.highlightedIndex - ScrollIndicator.vertical: ScrollIndicator { } + ScrollBar.vertical.policy: ScrollBar.AsNeeded + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + ListView { + id: myListView + implicitHeight: contentHeight + model: comboBox.popup.visible ? comboBox.delegateModel : null + currentIndex: comboBox.highlightedIndex + ScrollIndicator.vertical: ScrollIndicator { } + } } }