qtqcomboboxqstylesheet

QComboBox become ugly when changing main windows background


Before changing:

enter image description here

After changing parent widget styleSheet property to this:

background-color: rgb(5, 34, 78);

I see this:

enter image description here

QComboBox become really different. What happens? How to use regular QComboBox on dark background?

I am using Qt 5.5 without QML.


Solution

  • You have to set it to the main window only

    yourWindow->setStyleSheet("{background-color: #HexNumber}");

    or tell the QComboBox to not have style: yourWindow->setStyleSheet("QComboBox{background-color:none}");

    or

    yourWindow->setStyleSheet("QComboBox#ComboName{background-color:none}");