QComboBox background change by setting ::drop-down border through css



  • Hi all.

    I'm trying to edit the style of a combo in order to remove the border around the down arrow.
    I'm using the 5.6 Qt version.

    Here is the style:

    QHeaderView::section QComboBox {
        background-color: #585A5C;
        color: #F0F0F0;
    }
    
    QComboBox::drop-down {
        border: 0;
    }
    
    QComboBox::down-arrow {
        image: url('resources/images/arrow-down.svg');
    }
    

    By setting the border inside the drow-down CSS block, the combo is painted with the default-white window background color.
    This is a quite strange behavior and I'm pretty sure that it didn't happen using Qt 5.5.
    Any clue or suggestion?

    Thanks in advance.



  • up after edit


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Silly question but can you do the comparison with Qt 5.5 ?

    Otherwise you should at least post a minimal sample code that reproduces this.



  • I changed the first post, inserting the previously omitted QComboBox::down-arrow style block.

    I've found a solution, that is moving the image definition from ::down-arrow to ::drop-down block, like this:

    QComboBox::drop-down {
        border: 0;
        image: url('resources/images/Caret_down_font_awesome.svg');
    }
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.