Reputation: 11651
I currently have a class that inherits from QLabel
this class implements the methods mouseMoveEvent
and leaveEvent
. When the mouse is over this widget a dialog box is displayed. However the dialog box only disappears if a mouse click occurs elsewhere. I want the dialog box to disappear when the mouse moves out of the reqion of this widget. I therefore thought about using the leaveEvent
method which would call dialog.hide()
. My question is how can I determine if the mouse cursor is in the region of a widget ?
Upvotes: 1
Views: 2902
Reputation: 9176
Have a look at Qt - Determine absolute widget and cursor position. Two ways are explained there.. using coordinates and using QWidget::underMouse().
Upvotes: 2