Qt World Summit: Register Today!

ComboBoxStyle trouble changing style

  • 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!

  • Moderators

    Hi @Pheelbert,
    if you meant changing the background of dropdown list then you will need to do it in __dropDownStyle private property for now.
    eg: inside ComboBoxStyle

    __dropDownStyle: MenuStyle {
        itemDelegate.label: Text {
            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 Image inside the background: Rectangle { component.