QFrame::setBackgroundRole not working?
applefier last edited by applefier
I have a QTabWidget with sevaral tabs. The active tab's background color is lighter than the color of the "tab" of inactive tabs (which are of the same color as e.g. application's main menu background). Anyway, there are two colors that system provides - lighter and darker.
There is a widget lying inside one of the tabs, whose background color is set to the lighter one (as its parent tab is active) and I want to change it to the darker. The widget is a QFrame. Problem is that QFrame::setBackgroundRole(QPalette::ColorRole) is giving me the same result (stays light) for all three values of QPalette::ColorRole - QPalette::Window, QPalette::Base and QPalette::AlternateBase. Even the QPalette::Button produces the same result.
How do I change the widget's background color to the one provided by the system, the darker one?
EDIT. I know that I can save the palette e.g. inside the main menu widget and then send it to the widget I want to change, but I am interested if there is a more elegant way, like the one I tried (and which is wrong, apparently).
applefier last edited by
Ok, I just realized that I was asking for QPalette::Window of the widget itself, not the application.
Nothing wrong with being stupid.