PDA

View Full Version : QMenu focusOut event



Talei
14th December 2011, 00:41
Hello,
I have a problem with focus out event in QMenu subclass.

The problem is as fallow:
I have QSystemTrayIcon and on it QMenu. MainWindow is hidden so It don't receive any events.
What I want to do is to hide QMenu when user click outside of QMenu.

I tried focusOutEvent but this is not trigered when I click outside of QMenu (QMenu has on show: setFocus( Qt::MouseFocusReason ) and setFocusPolicy( Qt::StrongFocus ) ).

So the question how to hide menu assigned to QSystemTrayIcon when user clicks outside of that menu?

Talei
14th December 2011, 04:12
Solved main problem.

It turns out that parent of QMenu caused this behaviour. Parent was hidden and probably prevent QMenu to receive signals.