QGraphicsView::mousePressEvent not triggering
-
Qt 5.15
I have some code which runs on both linux and windows. When I run it on windows and perform certain actions, which includes a right mouse click and release, I see the mousePressEvent and mouseReleaseEvent for my graphicsView class being called. When I do the exact same thing with the linux build, I do not see either of these methods called.I then overrode QGraphicsView::event to try to track down where the linux build was failing. I do not see MyGraphicsView::event being called for either a mouse press or a mouse release, yet somehow mousePressEvent and mouseReleaseEvent are being called.
From my reading of the Qt code, these methods are called from QGraphicsView::event. They must be being called from somewhere else. Anyone know where?
Also, does anyone have suggestions on what is swallowing the mouse events on linux? Its not a general problem, most things work, but I'm tracking whether the code is in the middle of processing a mouse event, and that code isn't working, since the methods aren't called.
I am verifying that mouse events are enabled. They are.
On windows, mouseReleaseEvent seems to be immediately preceded by a paint event, InputMethodQuery event, and FocusAboutToChange. Not sure if that's relevant.
-
Hi,
Which Linux distribution are you using ?
With which window manager ?
Are you using the Qt version coming with your distribution ? -
Hi,
Which Linux distribution are you using ?
With which window manager ?
Are you using the Qt version coming with your distribution ? -
I have a bit more information. The graphicsview mouse events are coming from the scene. On both windows and linux, cSI_QTN_GRAPHICS_SCENE::event receives event 156 (GraphicsSceneMousePress) just before the view's mousePressEvent which makes sense. On windows, cSI_QTN_GRAPHICS_SCENE::event receives event 157 (GraphicsSceneMouseRelease) just before the mouseReleaseEvent. Event 157 does not show up on the linux build.
-
So this is what I think is happening.
In order for me to see this problem, I right-mouse-click, bring up a context menu and select an item.
On windows, this results in a mouse press event, a context menu event, and then a mouse release event.
On linux, this results in a mouse press event, and then a context menu event. There is no mouse release event. -
So this is what I think is happening.
In order for me to see this problem, I right-mouse-click, bring up a context menu and select an item.
On windows, this results in a mouse press event, a context menu event, and then a mouse release event.
On linux, this results in a mouse press event, and then a context menu event. There is no mouse release event.@james-b-s
I don't know whether or why this would differ from Windows to some Linux window manager, or whether there is anything different in the Qt implementation, but maybe in Linux WM the mouse release event is going to the context menu?