You may need to do this by subclassing QLineEdit, and installing it into the combo box (with QComboBox::setLineEdit()
). Then, override the focusIn() and focusOut() functions of QLineEdit, and set a style sheet with the appropriate background color in those functions.
Another way would be to install an event handler on the combo box, (and/or its associated QLineEdit) and trap focus in/out events, and change the style sheet then.