1

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 ?

Rajeshwar
  • 10,444
  • 24
  • 76
  • 145

1 Answers1

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
  • 7,927
  • 8
  • 54
  • 116