Important: Please read the Qt Code of Conduct -

[Solved] QWidget: Correct way to recognize mouseGrab loss?

  • In a MouseButtonPress event of a QWidget, I set an application-wide override cursor. I reset the cursor on the corresponding MouseButtonRelease.

    However, if the widget loses mouse grab for reasons other than the button release (e.g. because a context menu was opened), I do not receive the MouseButtonRelease.

    Which event notifies me that my widget has lost the mouse grab?

  • Solution: React on the LeaveEvent.

Log in to reply