Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QContextMenuEvent comes on mouse button release also?
Can multiple QContextMenuEvent's can come from one button down, move, release?
The documentation says when they come is platform dependent, but is a little fuzzy. For example, it says the event comes on RMB release on Windows (and for the Menu key.)
Specifically, on OSX, I seem to be getting the event on RMB press. Then, if the app execs a menu, and the user moves the mouse outside the menu, then back into the menu and releases RMB, I seem to get another event. And worse, the action of the menu item does not get executed. (But I think that sequence should be allowed by HIG interface guidelines.)
If the user keeps the mouse in the menu, the action is taken.
The problem could be in my code. My code actually ignores QContextMenuEvent, and handles RMB press to exec the menu. But I still can see that I appear to be getting the event on RMB release. I will code up a small test case if I necessary.
Am I making a mistake to handle RMB press? Since that doesn't follow interface guidelines on Windows? IOW, am I subverting the magic that Qt has done to shield me from this cross-platform issue?
I changed my code to handle contextMenuEvent instead of mousePressEvent (and exec a modal menu.)
On OSX, a user choosing an item from context menu has no effect if the mouse has left the menu and returned before release. I think that is a Qt bug, although a very minor, harmless one. I don't seem to get another contextMenuEvent on RMB release (which is good.)
On Windows Vista, the contextMenuEvent comes on mouse button down, unlike in native apps. Which I consider an undocumented deviation from the native interface guidelines, although a minor one, since a RMB click behaves as a user would expect (menu appears and stays open until clicked in again.
You should bring the subject on the interest mailing list, you'll find there Qt's developers/maintainers (this forum is more user oriented)
Your post and thus your findings will likely get buried and lost time passing by.
You should also check the "bug report system":http://bugreports.qt-project.org to see whether someone already posted something about that
I submitted a "bug":https://bugreports.qt-project.org/browse/QTBUG-37124
Thanks for sharing !
You should upload a sample program so other may test this