ComboBoxStyle trouble changing style
QML and Qt Quick
2
Posts
2
Posters
1.2k
Views
2
Watching
-
I don't see the changed background and I have no clue how to change the arrow and delegates afterwards..
ComboBox { anchors.left: parent.left anchors.leftMargin: 20 currentIndex: 0 model: ListModel { ListElement { text: "Test1"; } ListElement { text: "Test2"; } } style: ComboBoxStyle { background: Rectangle { color: "red" anchors.fill: parent } label: Label { text: control.currentText color: "blue" font.pointSize: 16 } } }Thanks for any help!
-
I don't see the changed background and I have no clue how to change the arrow and delegates afterwards..
ComboBox { anchors.left: parent.left anchors.leftMargin: 20 currentIndex: 0 model: ListModel { ListElement { text: "Test1"; } ListElement { text: "Test2"; } } style: ComboBoxStyle { background: Rectangle { color: "red" anchors.fill: parent } label: Label { text: control.currentText color: "blue" font.pointSize: 16 } } }Thanks for any help!
Hi @Pheelbert,
if you meant changing the background of dropdown list then you will need to do it in__dropDownStyleprivate property for now.
eg: insideComboBoxStyle__dropDownStyle: MenuStyle { itemDelegate.label: Text { width:200 height: 80 color: "blue" text: styleData.text } itemDelegate.background: Rectangle { color: styleData.selected ? "darkGray" : "transparent" } }And to add an arrow you can just use an
Imageinside thebackground: Rectangle {component.