[Qt-interest] QMainWindow: Prevent mouse from leaving.
Martin Guillon
MGuillon at movea.com
Tue Oct 27 16:44:42 CET 2009
Thanks a lot for your answer Rene,
I already tried the mouseMoveEvent trick with mousetracking. In it i set the position of the mouse to the middle of my window.
My problem is that when the mouse move too fast, the mouse is out of the window before you can receive the mousemoveevent. And so the application will lose the focus.
I just retried the grabmouse trick on my mainwindow and it doesn’t work. iF I move fast the mouse gets out and the application loses the focus. It comes back as soon as the pointer get back over the window.
Any other idea ? :P
-----Message d'origine-----
De : qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] De la part de R. Reucher
Envoyé : Tuesday, October 27, 2009 4:37 PM
À : qt-interest at trolltech.com
Objet : Re: [Qt-interest] QMainWindow: Prevent mouse from leaving.
On Tue, 27 Oct 2009 16:30:32 +0100, Martin Guillon wrote:
> Doesn’t work for a qmainwindow.
Why not?
> It wont prevent the mouse from leaving the window.
If you really want to prevent the mouse cursor from "visually" leaving
the widget, you should enable mouseTracking and catch the QWidget's
mouseMoveEvent()... ignore()'ing a move-event outside the widget.
> Moreover it wont event send mouse move event when the mouse
> is out of the mainwindow.
AFAICT, it will, because mouse events are "grabbed" by that widget.
> And finally I want to hide the cursor. With grab the cursor can still
> leave the window and so wont be transparent.
See above.
HTH, René
--
René Reucher
rene.reucher at batcom-it.net
http://www.batcom-it.net/
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list