[SOLVED] QMenuBar styling - hovering item
-
I wonder if this is a limitation of the style sheet or a bug on windows...
-
I think it's a bug on Windows 8.1
I'm back on windows 7 after uninstalling that **%% and hovering is working fine with this code:
@/********************************* QMenuBar **********************************/
QMenuBar {
background-color: transparent;
}QMenuBar::item {
color : white;
margin-top:4px;
spacing: 3px;
padding: 1px 10px;
background: transparent;
border-radius: 4px;
}QMenuBar::item:selected { /* when selected using mouse or keyboard */
background: #a8a8a8;
}QMenuBar::item:pressed {
background: #888888;
}@Solution :
1-Uninstall Windows 8.1
2-install a good OS -
You should however consider opening a report about that, at least to let the developers known there's something fishy going on with Windows 8.1
-
It's not the operating system.
@QMenuBar::item:hover@
is incorrect, rather counter-intuitively actually.
@QMenuBar::item:selected@
is correct and works as expected on my Windows 8.1 system.
That change was made in the last code example posted by maximus, presumably after he switched operating systems, so naturally it works.
-
hover vs selected is relative. You could very well have your cursor going over the menubar entries without having clicked on them, that would be hovering, wouldn't it ?
-
When it comes to menu bars we have to use :selected. It does seem strange, but perhaps this is because the standard behavior, at least on Windows, is the color doesn't change between a hover and a click, so a separate setting for a hover is superfluous. Just a guess on my part.
This behavior is the same on my Chakra Linux running KDE, but I don't know about the Gnome desktop or indeed the Mac. The fact the Qt developers made this choice makes me think this is common.
Just a little "gotcha" along the way.
-
That might simply be related to QMenu being used elsewhere like in a contextual menu.
However, if there's indeed a difference of handling between menubar and contextual QMenu, that should be mentioned in the documentation.