Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions
[Solved] MenuBar Color
I would like to be able to set a QMenuBar's background color. It sounds easy enough to do - just get the pallete and set the QPalette::window color. This in fact works on KDE, but for some reason it does not work on Ubuntu nor does it work on Windows. Is this a bug ? Or is it that the window managers do not let this happen.
It does work if I set the color with a style sheet for menubar. But the problem here is that this also sets the colors of the menus and I do not want this. That is only want the menubar colour to change.
The reason for the multicolour menubars is that the user can have lots of toplevel main windows open with my application and I want them to quickly be able to find the one they want by colour association.
Hope someone has a answer for me. By the way the behaviour describe above is with Qt 5.2 and Qt 5.3
IIRC, the OS can freely ignore the palette, so the style sheet path is probably your best bet
I ended up doing it with style sheets and to keep the menus the same color I do something like the follwing, its a bit awkward but it works
@colorStr = QString("background-color:") + QString(color.name()) + ";";
What about styling QMenuBar and QMenu in one stylesheet ?