Using QWidget::grabMouse() on Mac
-
Hi all,
I got a problem about QWidget::grabMouse().I created my customized widget on a QDialog.
And I want use the grabMouse() to let my customized widget to catch all mouse event.
On Windows, the grabMouse() works Ok.
But, on Mac, it just works fine when the mouse is inside the QDialog,
but when the mouse moved to the outside frame of QDialog, my customized widget couldn't grab any mouse event.I found the QWidget Document notices that:
Note: (Mac OS X developers) For Cocoa, calling grabMouse() on a widget only works when the mouse is inside the frame of that widget. For Carbon, it works outside the widget's frame as well, like for Windows and X11.
So, Does it mean I couldn't use the grabMouse() On Mac works fine as well as On Windows?
If I really want to use the grabMouse() to catch all mouse events when the mouse is outside the frame of QDialog that my customized widget is on, how can I achieve that?
Many thanks for the help! :)
-
I have the same problem. As a workaround I tried to "clue" the mouse to the middle of my window with:
cursor().setPos(mapToGlobal(QPoint(width()/2,height()/2)));But since the upgrade to osx lion, this does not work anymore. In fact, the grabMouse() still allows the cursor to "leave" the window. When programming a 3d opengl egoshooter, this it not helpfull at all...
we need help!