-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.7.0
-
None
-
50148c6fa19bb0af40a9ece8b8893ad621780745
I cannot override popup.contentItem on ComboBox because the original ComboBox' popup references its original contentItem by id.
So trying something like this:
ComboBox {
model: ["First", "Second", "Third"]
id: combo
popup.contentItem: Rectangle {
anchors.fill: parent
color: "blue"
border.color: "red"
}
}
with the original ComboBox code:
//! [popup]
popup: T.Popup {
y: control.height - (control.visualFocus ? 0 : 1)
width: control.width
implicitHeight: listview.contentHeight << -- fails here
topMargin: 6
bottomMargin: 6
contentItem: ListView {
id: listview
clip: true
model: control.popup.visible ? control.delegateModel : null
currentIndex: control.highlightedIndex
Rectangle {
z: 10
parent: listview
width: listview.width
height: listview.height
color: "transparent"
border.color: "#bdbebf"
}
T.ScrollIndicator.vertical: ScrollIndicator { }
}
background: Rectangle { }
}
//! [popup]
fails on the marked line with:
ComboBox.qml:108: TypeError: Cannot read property of null
I am not sure if users are supposed to fiddle with properties of internal child elements, so you can decide how to deal with this. ![]()
Just as an explanation, what I was trying to do here is getting rid of the border around the popup.
| For Gerrit Dashboard: QTBUG-56297 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 172547,2 | ComboBox: fix unintentional deps between the popup and its content item | 5.7 | qt/qtquickcontrols2 | Status: MERGED | +2 | 0 |
| 175998,3 | Improve the custom ComboBox example | dev | qt/qtquickcontrols2 | Status: MERGED | +2 | 0 |