diff --git a/org.kde.desktop/ComboBox.qml b/org.kde.desktop/ComboBox.qml --- a/org.kde.desktop/ComboBox.qml +++ b/org.kde.desktop/ComboBox.qml @@ -65,7 +65,7 @@ property int indexUnderMouse: -1 onWheel: { if (wheel.pixelDelta.y < 0 || wheel.angleDelta.y < 0) { - controlRoot.currentIndex = Math.min(controlRoot.currentIndex + 1, delegateModel.count -1); + controlRoot.currentIndex = Math.min(controlRoot.currentIndex + 1, model.count -1); } else { controlRoot.currentIndex = Math.max(controlRoot.currentIndex - 1, 0); } @@ -134,7 +134,7 @@ selectedTextColor: Kirigami.Theme.highlightedTextColor selectByMouse: !Kirigami.Settings.tabletMode - cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : undefined + cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : null font: controlRoot.font horizontalAlignment: Text.AlignLeft @@ -202,9 +202,10 @@ contentItem: ListView { id: listView - clip: true + implicitHeight: contentHeight - model: controlRoot.popup.visible ? controlRoot.delegateModel : null + model: controlRoot.model + delegate: controlRoot.delegate currentIndex: controlRoot.highlightedIndex highlightRangeMode: ListView.ApplyRange highlightMoveDuration: 0 diff --git a/tests/testComboBox.qml b/tests/testComboBox.qml new file mode 100644 --- /dev/null +++ b/tests/testComboBox.qml @@ -0,0 +1,29 @@ +import QtQuick 2.3 +import QtQuick.Layouts 1.3 +import QtQuick.Controls 2.3 + +ApplicationWindow +{ + visible: true + + ColumnLayout { + anchors.fill: parent + ComboBox { + Layout.fillWidth: true + textRole: "key" + model: ListModel { + id: comboModel + ListElement { key: "First"; value: 123 } + ListElement { key: "Second"; value: 456 } + ListElement { key: "Third"; value: 789 } + } + } + + ListView { + Layout.fillWidth: true + Layout.fillHeight: true + model: comboModel + delegate: Label { text: key } + } + } +}