How to change the color of the focus Widget in QT?
-
How to change the color of the focus Widget in QT?
-
Hi
You mean what ever widget that has keyboard focus ? -
The issue is a little bit more complicated than you might think, as there might simply not be a "color of a button". Some styles on some OSes might use a gradient, an outline or even animate the button on hover/focus/click etc.
That being said you can override the background color of a button when it's focused like this:yourButton->setStyleSheet("QPushButton:focus { background-color: red; }");
but be aware that this will disable native styling of the button so on some platforms/themes it will look out of place.
-
Thanks to you I've been able to solve