[Solved] Can't set background-color of a QPushButton.
General and Desktop
2
Posts
1
Posters
4.9k
Views
1
Watching
-
I am having many issues with QSS, but lets take this 1 step at a time. I try to style a QPushButton. Text color is fine, I can change that, but not background-color... I've tried accessing the button in many ways using CSS class, or button itself (#). They can all change the text color fine, but not background color.
-
Allright, step #1, read updated documentation!
From http://doc.qt.io/qt-5/stylesheet-reference.html
bq. Warning: If you only set a background-color on a QPushButton, the background may not appear unless you set the border property to some value. This is because, by default, the QPushButton draws a native border which completely overlaps the background-color. For example,
@QPushButton { background-color: red; border: none; }@