Happens on Windows only. Tested on Qt 4.8.6. Not tested on Qt5.
When a window creates a modal child, the child grabs the parent's event loop, which results that the parent does not get a QEvent::FocusOut event, though the focus has been lost.
This results in weird effects if there is an event filter attached to the parent. The filter still processes events without knowing that the widget has already lost the focus.
In Krita we workarounded this bug using this patch: