[Resolved] Close Widget Window if mouse clicked outside of it
This is sort of a chicken and egg problem. I'd like my widget window to be closed when the mouse clicks outside. As I understand it, there will be no mouse events for my widget for a click occurring outside of it. There is a SetFocus slot, but where is its counterpart or focus loss? "focusOutEvent" doesn't get called for my class.
My widget window is a child window of a widget always shown on my main window and it's a "Qt::ToolTip", so I assume some problems could arise from that fact. Any way around that?
My Goal: I have a custom toolbar widget where buttons on it may have "drop down" widgets. These drop down widgets have no standard windows frame. I don't want them to "steal" caption focus from the main window and I want them to disappear as soon as the user clicks ANYWHERE on the screen outside of their region. I have having serious difficulties finding a strategy that's not compromise on Qt to get this done.
Am I missing something? (bet I am).
Okay, I am using
@setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);@
Now my window receives the "focusOutEvent" event correctly and the focus isn't "stolen" from my main window thanks to the Qt::Popup.