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 ?
Asked
Active
Viewed 2,601 times
1

Rajeshwar
- 11,179
- 26
- 86
- 158
-
You can get widget under cursor and compare it with your widget. – Dmitry Sazonov Jun 25 '14 at 21:14
-
How do I get the widget under cursor ? – Rajeshwar Jun 25 '14 at 21:16
1 Answers
2
Have a look at Qt - Determine absolute widget and cursor position. Two ways are explained there.. using coordinates and using QWidget::underMouse().

Community
- 1
- 1

Silicomancer
- 8,604
- 10
- 63
- 130