Menu bar items don't highlight on mouse-over

• Jun 21, 2020 - 18:51
Reported version
Graphical (UI)
S4 - Minor

OS: Windows 10 (10.0), Arch.: x86_64, MuseScore version (64-bit):, revision: 148e43f

The menu bar items don't highlight when you mouse over them. They did in MS 2.3.2.


I looked into this. It turns out that due to the way the widgets are styled (using CSS), it isn't possible to get the hover highlight working without affecting other visual attributes of the menu, which in turn can't be corrected using just pure CSS. The reason is that if you define any CSS for a widget (such as, in this case, menu-bar items), the CSS completely overrides some code-based size and color calculations that cannot be recreated with more CSS. (You can get it very close, but not perfect — and believe me, I tried.)

Maybe this is naive, but why on earth are we doing custom styling of menus? Shouldn't Qt handle all that for us? Is this because we want to be able to programmatically override the font?

In reply to by Marc Sabatella

As far as I can tell, it's because we've made some tweaks to the standard light and dark modes for the “Fusion” theme, and also because we want to be able to switch between light and dark on the the fly. I haven't gone as far as to check who it was that decided to do these things. In any case, CSS is the method that Qt exposes to us to be able to do them, and CSS isn't powerful enough to simulate some of the things that are being done in the default theme (which is implemented in code, which I looked at when trying to figure out why a simple change to CSS completely broke other aspects of the styling).