Commit c7ee522c authored by David Redondo's avatar David Redondo 🏎

Prevent delegates and scrollbar overlapping in combobox popups

Attached scrollbar is positioned inside the ListView, use a ScrollView instead
parent c2497012
...@@ -32,7 +32,7 @@ T.ComboBox { ...@@ -32,7 +32,7 @@ T.ComboBox {
rightPadding: controlRoot.editable && !controlRoot.mirrored ? 24 : padding rightPadding: controlRoot.editable && !controlRoot.mirrored ? 24 : padding
delegate: ItemDelegate { delegate: ItemDelegate {
width: controlRoot.popup.width width: listView.width
text: controlRoot.textRole ? (Array.isArray(controlRoot.model) ? modelData[controlRoot.textRole] : model[controlRoot.textRole]) : modelData text: controlRoot.textRole ? (Array.isArray(controlRoot.model) ? modelData[controlRoot.textRole] : model[controlRoot.textRole]) : modelData
highlighted: mouseArea.pressed ? listView.currentIndex == index : controlRoot.highlightedIndex == index highlighted: mouseArea.pressed ? listView.currentIndex == index : controlRoot.highlightedIndex == index
property bool separatorVisible: false property bool separatorVisible: false
...@@ -205,22 +205,25 @@ T.ComboBox { ...@@ -205,22 +205,25 @@ T.ComboBox {
// like ApplicationWindow, which we don't want. // like ApplicationWindow, which we don't want.
Controls.Overlay.modal: Item { } Controls.Overlay.modal: Item { }
contentItem: ListView { contentItem: ScrollView {
id: listView background: Rectangle {}
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
// this causes us to load at least one delegate ListView {
// this is essential in guessing the contentHeight id: listView
// which is needed to initially resize the popup
cacheBuffer: 1 // this causes us to load at least one delegate
// this is essential in guessing the contentHeight
implicitHeight: contentHeight // which is needed to initially resize the popup
model: controlRoot.delegateModel cacheBuffer: 1
delegate: controlRoot.delegate
currentIndex: controlRoot.highlightedIndex implicitHeight: contentHeight
highlightRangeMode: ListView.ApplyRange model: controlRoot.delegateModel
highlightMoveDuration: 0 delegate: controlRoot.delegate
boundsBehavior: Flickable.StopAtBounds currentIndex: controlRoot.highlightedIndex
T.ScrollBar.vertical: Controls.ScrollBar { } highlightRangeMode: ListView.ApplyRange
highlightMoveDuration: 0
boundsBehavior: Flickable.StopAtBounds
}
} }
background: Kirigami.ShadowedRectangle { background: Kirigami.ShadowedRectangle {
anchors { anchors {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment