Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to change color of non editable QComboxBox?



  • Hi,

    I'm using Qt 5.96 on Windows 10 desktop and like to change the standard background color of a non editable QComboBox to a lighter grey.

    I tried following style sheet:

    ui->Combobox->setStyleSheet("background-color: rgb(238,238,238); border: 1px solid grey;");

    But the combobox lost its flat design and its drop-down-button showed up looking like a Win98 button.

    What is the right way to change the background color of a non editable QComboBox by keeping its flat design?


  • Lifetime Qt Champion

    Hi,

    You should rather go with QPalette but note that the style used for the application is free to ignore these. In particular the native styles will follow the OS guidelines and rules. This stack overflow thread has some good suggestions.


Log in to reply