Hide Dialog When Mouse Moves Outisde
I have a QDialog with setWindowFlags(Qt::Popup). I want to hide the QDialog as soon as the mouse moves outside the boundaries of the QDialog.
I thought I might be able to use QWidget::focusOutEvent, but moving the mouse off the QDialog doesn't cause the QDialog to lose focus, so that doesn't work.
I thought about tracking the mouse movement using QWidget::mouseMoveEvent, but this will only be called while the mouse is moving over the QDialog and not once it is moving outside the QDialog.
Has anyone done this before or does anyone have any ideas?
Re: Hide Dialog When Mouse Moves Outisde
May be you will need QWidget::grabMouse Do read the warnings that come in the doc.
Re: Hide Dialog When Mouse Moves Outisde
I found void QWidget::leaveEvent ( QEvent * event ), which I can use to achieve exactly what I need.