Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.8.0
-
Windows
-
90a0d4023206cfeed1bec43cb11e026ff0379d3d
Description
Append first items to ComboBox&ListModel so that the drop down would need a scroll bar (more than 10 on the example). Then clear the list and check the ComboBox. It still opens the empty rectangle sized to max height. Expected would be that no rectangle would be shown. After that it keeps showing max height rectangle even with couple items. Attached is a sample application where the problem is easily tested.
import QtQuick 2.7 import QtQuick.Window 2.2 import QtQuick.Controls 2.0 Window { visible: true width: 300 height: 300 title: qsTr("Hello World") ComboBox { id: comboBox height: 30 width: 100 font.pixelSize: 20 contentItem: Text { text: comboBox.displayText font: comboBox.font color: comboBox.activeFocus ? "black" : "gray" horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } background: Rectangle { color: comboBox.activeFocus ? "pink" : "skyblue" } delegate: ItemDelegate { width: comboBox.width contentItem: Text { text: modelData verticalAlignment: Text.AlignVCenter } highlighted: comboBox.highlightedIndex == index } model: ListModel { } onActivated: { console.log("clicked: " + currentText + " currentIndex: " + currentIndex) } } Button{ id: append text: "append" width: 80 height: 30 anchors.left: comboBox.right anchors.leftMargin: 3 property int number: 0 onClicked: { comboBox.model.append({"modelData": number}) number++ console.log("count " + comboBox.count); } } Button{ text: "clear" width: 80 height: 30 anchors.left: append.right anchors.leftMargin: 3 property int number: 0 onClicked: { comboBox.model.clear() } } }
Attachments
Issue Links
- resulted in
-
QTBUG-61935 ComboBox does not expand on iOS
-
- Closed
-