Blank QCursor is only temporary
-
I assume I am missing something small, but fundamental. I "hide" the Cursor in a certain mode in my application, which works until I move the mouse. Once I move the mouse, the cursor reappears. I'd like it to remain hidden until I explicitly set the cursor to an arrow.
This is what I do in the QMainWindow:
if(mouse)
{
_glScene->acceptTouchEvents(false);
_skipMouseUpdate = true;
grabMouse();
qApp->setOverrideCursor( QCursor( Qt::BlankCursor ) );} else { _glScene->acceptTouchEvents(true); releaseMouse(); qApp->setOverrideCursor( QCursor( Qt::ArrowCursor ) ); }
I am not accidentally calling qApp->setOverrideCursor( QCursor( Qt::ArrowCursor ) );. My QMainWindow contains many children, including a QGraphicsView, QGraphicsScene and QGraphicsObject.
Thanks, AB
-
Where is that code placed? In some event handler? Maybe one of the widgets you move the mouse over sets a cursor?
In any case you should not call setOverrideCursor like that. Instead of setting ArrowCursor to reset the cursor you should call restoreOverrideCursor(). What you're doing is pushing new cursors on the stack and never popping them back.
-
Where is that code placed? In some event handler? Maybe one of the widgets you move the mouse over sets a cursor?
In any case you should not call setOverrideCursor like that. Instead of setting ArrowCursor to reset the cursor you should call restoreOverrideCursor(). What you're doing is pushing new cursors on the stack and never popping them back.
@Chris-Kawa said:
restoreOverrideCursor
Thank you very much for the advice to reset the override cursor.
The code is in a sort of event handler. It is possible that a widget overrides it, but I am not sure where to look for it as this is the only location in the entire project that references the QCursor class.
edit: after a bit of investigation, the problem goes away if I comment out grabMouse(). Haven't found a good work around yet, but it's a start.