Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.6.3
-
None
-
Windows 10 Pro (multi-screen)
-
-
bde6a049494f40cd71004d6926899f115af0c3e6 (qt/qtbase/5.12)
Description
QDesktopServices::openUrl may launch an external application that will trigger our application to be deactivated, in that case, Qt attempts to close any active popup widget (see src\qtbase\src\widgets\kernel\qapplication.cpp line 3128).
Unfortunaly this will make our application to be reactivated and its window to be set into foreground again as indicated by the following backtrace:
qwindowsd.dll!QWindowsWindow::requestActivateWindow() Line 2012 Qt5Guid.dll!QWindow::requestActivate() Line 986 Qt5Widgetsd.dll!QWidgetPrivate::setFocus_sys() Line 6593 Qt5Widgetsd.dll!QApplicationPrivate::setFocusWidget(QWidget * focus, Qt::FocusReason reason) Line 1848 Qt5Widgetsd.dll!QWidget::setFocus(Qt::FocusReason reason) Line 6528 Qt5Widgetsd.dll!QApplicationPrivate::closePopup(QWidget * popup) Line 3887 Qt5Widgetsd.dll!QWidgetPrivate::hide_helper() Line 8019 Qt5Widgetsd.dll!QWidget::setVisible(bool visible) Line 8225 Qt5Widgetsd.dll!QWidget::hide() Line 7995 Qt5Widgetsd.dll!QWidgetPrivate::close_helper(QWidgetPrivate::CloseMode mode) Line 8354 Qt5Widgetsd.dll!QWidget::close() Line 8413 Qt5Widgetsd.dll!closeAllPopups() Line 3007
This may occur when the QDesktopServices::openUrl is triggered from a QMenu action shown on a popup (QWidget with Qt::Popup flag).
See attachment to reproduce.
A workaround is to call:
if (QApplication::activePopupWidget()) QApplication::activePopupWidget()->close();
before QDesktopServices::openUrl.
Attachments
Issue Links
- relates to
-
QTBUG-25852 ActiveQt: QAxWidget steals keyboard focus
- Closed
- resulted in
-
QTBUG-71991 [reg 5.12 b1->5.12 rc]/Windows: VST-embedded Qt app can't get focus back after clicking outside
- Closed
For Gerrit Dashboard: QTBUG-70810 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
241871,2 | QtWidgets: Fix Qt application coming to the foreground when launching app by popup menu | 5.12 | qt/qtbase | Status: MERGED | +2 | 0 |