PDA

View Full Version : Stop mouse event and start on another widget



Alundra
24th March 2015, 05:14
Hi,
I made a tabbed window system, when the user click on one tab if the mouse move is outside the tabbar that create a new tabbed window with the window inside it.
The problem is the mouse event, when the new window is created the mouse event of the tabbar has to be stopped, but how do that correctly ?
Another problem is when the user tab from one tabbar to another, the mouse event has to be stopped on the first and start on the new tabbar.
If the second problem is solved, surely the first is solved the same time, but how solve that ?
Maybe Qt has a way to emulate the mouse press event ? Or a better way to solve that ?
Thanks for the help

EDIT : Maybe that's better to have a function in the tabbar to enable a flag "IsDragging" which is called on the new tabbar when the user do the action ?

Kryzon
26th March 2015, 22:39
That's exactly the same problem in that detachable dock example we've discussed before: how to "clear" or reset the mouse grabbing state of a widget?

The only way I found that works is to emit an OS-level mouse event, a synthetic mouse release event from the OS API. I would also like to know if there's a more internal, platform agnostic way.
I've tried asking a developer but it isn't a supported use case: https://bugreports.qt.io/browse/QTBUG-43698

You can't use an event filter for this, because when you get to the event filter body the tab bar is already grabbing the mouse.