[PyQt] Setting text color for combo box fails on windows vista

David Boddie dboddie at trolltech.com
Fri Aug 15 17:10:33 BST 2008

On Fri Aug 15 16:44:46 BST 2008, Markus Dahlbokum wrote:

> I'm trying to modify the text color of a QComboBox via
> QPalette.setColor(QPalette.ButtonText, QColor). On linux there is no
> problem but on windows vista the color won't change. When I switch the
> application style to 'cde' the modification works.
> Is there a known problem with the vista style?

I think it's a limitation of the style engine on Windows Vista. The widget
style sheets documentation says this:

  However, this wasn't guaranteed to work for all styles, because style
  authors are restricted by the different platforms' guidelines and (on
  Windows XP and Mac OS X) by the native theme engine.


It might be worth it to try and set a style sheet on the combo box with
something like this:

  myComboBox.setStyleSheet("QComboBox { color: red }")

Does this work?


More information about the PyQt mailing list