Opened 14 years ago

Closed 14 years ago

#113 closed defect (fixed)

Popup window doesn't close when clicking outside if it's the only Qt window on screen

Reported by: Dmitry A. Kuminov Owned by:
Priority: blocker Milestone: Qt GA
Component: QtGui Version: 4.5.1 Beta 5
Severity: low Keywords:
Cc:

Description

The problem can be best seen with the examples/desktop/systray example: if we minimize it to tray, call the menu click outside it, then call it again and click outside again, the menu will remain visible which is odd.

Change History (2)

comment:1 Changed 14 years ago by Silvan Scherrer

Severity: low

comment:2 Changed 14 years ago by Dmitry A. Kuminov

Resolution: fixed
Status: newclosed

The issue turned out to be really complex as we don't use WinPopupMenu? when we show popup menus and therefore we lack some magic performed by it.

The matter is that, by convention, when a popup window is shown it does not steal the activation state from the currently active window. In case when the active window is the Qt window it's fine as it will redirect all keyboard and mouse widgets to the popup anyway.

However, if the active window does not belong to the Qt application when our popup is shown, the latter won't get any keyboard input. Moreover, when the mouse is clicked outside it, the popup won't get any focus lost message as well because it didn't have focus.

To solve this problem I basically had to steal the focus from another application when it's the case. I also had to correct the message flow (see the code) as this behavior turned out to be unexpected by PM. The solution is committed in r432. Note that as already mentioned it also fixes the keyboard input for popups opened while other applications are active. In particular, this lets popups in the extended system tray be controlled with the keyboard (it wasn't possible before). I also fixed a case when opening the popup in the extended system tray didn't close the normal popups in the Qt application.

PS. Another problem I had is that I got yet Internet connection loss (again!) which blocked my work for some time; This is the worst ISP I got for 8 years in Moscow and the really bad thing is that there are no broadband alternatives in this district... Fortunately I managed to set up a GPRS connection through my mobile to commit and comment.

Note: See TracTickets for help on using tickets.