stefanadelbert
9th July 2010, 04:48
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?
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?