qtstylesheetqcombobox

How to change the color of non-selected item in QComboBox using stylesheets?


I would like to change the style of the QComboBox. I would like exactly to put the text of the non-selected item's text (FR, ES, IT, ..) in white because they are in black.

enter image description here

This is the used style sheet :

QComboBox
{
    background-color:black;
    border-color:white;
    color:red;
    border-width: 1px;
    border-style: solid;
    padding: 1px 0px 1px 3px;
    selection-color:white;
}

Solution

  • To change the style of the items of a combobox, you can style the inner QAbstractItemView

    Example:

    QComboBox QAbstractItemView {
        background-color: rgb(41,41,41);
        color: white;
     
        selection-background-color: rgb(88, 88, 88);
        selection-color: rgb(200, 200, 200);
    }