-
Bug
-
Resolution: Done
-
Not Evaluated
-
None
-
5.2.1
-
None
-
OSX 10.9.2
QWidget::setCursor() has no effect on windows which are created beneath the mouse (ie. you need to move the cursor outside the window/widget and back in again before setCursor() starts to work correctly. This is most noticeable for windows which are created maximised. The following code shows the problem :
setCursorTest.cpp
#include <QtWidgets/QApplication> #include <QtWidgets/QWidget> class TestWindow : public QWidget { public : TestWindow() { setMouseTracking( true ); setWindowState( windowState() | Qt::WindowMaximized ); } virtual void mouseMoveEvent( QMouseEvent* event ) { static uint8_t shape = Qt::ArrowCursor; setCursor( QCursor( ( Qt::CursorShape ) shape ) ); shape = ++shape % Qt::LastCursor; } }; int main( int argc, char** argv ) { QApplication app( argc, argv ); TestWindow window; window.setVisible( true ); return app.exec(); }
The cursor should change every time the mouse moves, but does not (until the mouse leaves the window and re-enters).
For what it's worth, the root of the problem appears to be in QCocoaWindow.mm where m_windowUnderMouse is initialised to false, regardless of the mouse position.