PDA

View Full Version : Strange behaviour of hovering in QMenu



CassandraD
12th May 2014, 17:49
So, I have a QMenu with QWidgetAction in it and separator. Also, it includes many other QActions.

The trick is, when you add sub-menu, separator, widget action and several actions below (exactly in this order) and try to hover from menu item which have sub-menu through separator to button on your QWidgetAction, this button will not be hovered.
But, when you try to move mouse from any another QAction which doesn't divided with QWidgetAction by separator, all works fine, and button on QWidgetAction gets hover (actually, button gets hover in all cases, — WA_Hover flag is set, — but we could see repaint and actual visual changes only in second example).

I have tested this actions in Qt 4.7 and latest 5.2, the behavior is different. In latest version, separator do something and you can get hover. But if you try to move mouse from item with sub-menu without going through separator, still no effect.
So, I created https://github.com/CassandraDied/CustomMenuWidget on github to demonstrate the problem and would like to know if o other platforms (I'm using Windows 7) or versions the behavior is different or the same. And, of course, what to do to solve my problem and get hover under buttons.