Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.5.3, 4.6.0
-
None
Description
Calling grabMouse on a widget does not work when the mouse is moved outside the application window Mac OS X.
This is not going to work with Cocoa, but should probably work with Carbon.
On Windows and X11 it works like expected.
#include <QApplication> #include <QMainWindow> #include <QToolBar> #include <QAction> #include <stdio.h> #include <time.h> class test: public QMainWindow { Q_OBJECT; public: test() :QMainWindow() { mToolBar = new QToolBar(this); addToolBar(mToolBar); mTest = new QAction(this); mTest->setText("test2"); connect (mTest, SIGNAL(triggered()), this, SLOT(onClicked())); mToolBar->addAction(mTest); setMouseTracking(true); } protected: void mouseMoveEvent ( QMouseEvent * /* event */ ) { printf("mouse move event %x\n", (int)time(0)); } public slots: void onClicked() { grabMouse(); } private: QAction *mTest; QToolBar *mToolBar; }; int main(int argc, char *argv[]) { QApplication app (argc, argv); test mw; mw.show(); return app.exec(); } #include "moc_qttest.cpp"