Mouse Cursor reset problem
i have item delegate that when the mouse event is over icon i change its Cursor to Qt::PointingHandCursor
when its off i set it back to Qt::ArrowCursor . its working fine .
the problem is that besides when it over the icon . it allways stack on Qt::ArrowCursor
even in situation when the icon needs to changes nativly like when resizing the windows or when over native push button . it always Qt::ArrowCursor.
how can i force the Cursor act normally when its is no over the icon?
here is what i do :
- {
- // Emit a signal when the icon is clicked
- {
- .rect().translated(AddIconPos(option));
- QRect iconRemoveRect =
- m_iconRemove.pixmap(iconRemoveSize.width(), iconRemoveSize.height())
- .rect().translated(RemoveIconPos(option));
- if(closeButtonRect.contains(mouseEvent->pos()))
- {
- }
- else if(iconRemoveRect.contains(mouseEvent->pos()))
- {
- }
- else
- {
- }
- }
- {
- .rect().translated(AddIconPos(option));
- QRect iconRemoveRect =
- m_iconRemove.pixmap(iconRemoveSize.width(),iconRemoveSize.height())
- .rect().translated(RemoveIconPos(option));
- if(closeButtonRect.contains(mouseEvent->pos()))
- {
- ;
- }
- else if(iconRemoveRect.contains(mouseEvent->pos()))
- {
- ;
- }
- }
- return false;
- }
5 replies
You’re probably looking for restoreOverrideCursor to undo the effects of setOverrideCursor.
You must log in to post a reply. Not a member yet? Register here!




