When application has popup active, the popup gets leave event when mouse cursor leaves the application window, but when mouse cursor enters the application window later, the enter event is sent to main window:
Steps to reproduce:
1) Start the attached application
2) Click "Popup" button (Duplicate leaves and enter to QMenu here are a separate issue:
3) Move the cursor outside application -> Leave event for QMenu
4) Move the cursor back inside application -> Enter event for MainWindow
5) Repeat steps 3 & 4 -> Same inconsistent results.