mirror of
https://github.com/nomic-ai/gpt4all
synced 2024-11-10 01:10:35 +00:00
Make the chatview combo scrollable.
Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
parent
88f5face2b
commit
c87ccf4124
@ -321,7 +321,7 @@ Rectangle {
|
||||
}
|
||||
delegate: ItemDelegate {
|
||||
id: comboItemDelegate
|
||||
width: comboBox.width
|
||||
width: comboItemPopup.width
|
||||
contentItem: Text {
|
||||
text: name
|
||||
color: theme.textColor
|
||||
@ -336,6 +336,35 @@ Rectangle {
|
||||
}
|
||||
highlighted: comboBox.highlightedIndex === index
|
||||
}
|
||||
popup: Popup {
|
||||
id: comboItemPopup
|
||||
y: comboBox.height - 1
|
||||
width: comboBox.width
|
||||
implicitHeight: Math.min(window.height - y, contentItem.implicitHeight)
|
||||
padding: 0
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: comboBox.width
|
||||
implicitHeight: comboItemPopupListView.implicitHeight
|
||||
ScrollView {
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
ListView {
|
||||
id: comboItemPopupListView
|
||||
implicitHeight: contentHeight
|
||||
model: comboBox.popup.visible ? comboBox.delegateModel : null
|
||||
currentIndex: comboBox.highlightedIndex
|
||||
ScrollIndicator.vertical: ScrollIndicator { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
color: theme.black
|
||||
}
|
||||
}
|
||||
|
||||
Accessible.role: Accessible.ComboBox
|
||||
Accessible.name: currentModelName()
|
||||
Accessible.description: qsTr("The top item is the current model")
|
||||
|
Loading…
Reference in New Issue
Block a user