Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
4.5.3, 4.7.1, 4.7.2, 4.7.3, 5.1.1, 5.3.1
-
CentOS release 5.7
Ubuntu Linux
Description
There appears to be no way to change the text colour of a "closed", non-editable QComboBox, which is represented by a button, when using the GTK+ GUI Style. In particular, the following have no effect:
QComboBox *combo=new QComboBox;
...
combo->setStyleSheet("color: red");
...
QPalette palette;
palette.setColor(QPalette::ButtonText, QColor("blue"));
palette.setColor(QPalette::WindowText, QColor("blue"));
combo->setPalette(palette);
- the button text is still black after this. Or, I suppose more generally, the colour of the active Gtk theme. After setting the stylesheet, the colour of entries in the combo's popup menu does change, but again, the button is unaffected. I've tested the setStyleSheet() and setPalette() methods independently, of course.
If the editable property is set to true, so that the combobox is drawn as a "text entry" instead of a button, the colour changes as expected. It also does if switching to a different global style via Qt Configuration. Unfortunately, GTK+ is the default on typical setups where our software is installed, and forcing users to change this does not seem right.
This is also not a limitation for buttons in general, i.e. stylesheet or palette colours will indeed be used for a normal QPushButton.
Attachments
Issue Links
- relates to
-
QTBUG-92199 [REG] The color of QLineEdit and QPlainTextEdit placeholder text is not grayed-out if stylesheet was applied
- Closed
-
QTBUG-93009 QPalette::PlaceholderText color is not followed after setting color in a style sheet
- Closed