QComboBox text Color with CSS



  • Hi I need to change the color of a QComboBox's text in read-only I try this, but nothing happens

    @QComboBox:!editable {
    color: white;
    }@

    If I change the code for

    @QComboBox:editable {
    color: white;
    }@

    all QComboBox's text color change (read-only and writable), but I want to use differents colors in each ones

    I'm using Qt 4.6.3 in windows may be a bug

    Thanks



  • Try this in your qss:
    @
    QComboBox:read-only {
    ...
    }

    QLineEdit:editable {
    ...
    }
    @



  • Thanks for the answer, but nothing.

    Others codes works in QComboBox:!editable, for example

    @QComboBox:!editable {
    font: bold 10pt;
    }@

    but for some reason color: white not

    I have a little clue, if the application lost focus (the entire application, not only the widget) the text become white, but when the focus is in the application again text changes his color, all the time the focus in the application is in another widget not in the QComboBox

    Any Idea?


Log in to reply
 

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