QtWidgets: Fix Qt application coming to the foreground when launching app by popup menu
Check on the application state before requesting activation. Fixes: QTBUG-70810 Change-Id: I550137dc00209b17f4b3c033287ceef1b871ff50 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
2bd6f5e8d1
commit
bde6a04949
@ -6600,9 +6600,12 @@ QWidget *QWidgetPrivate::deepestFocusProxy() const
|
||||
void QWidgetPrivate::setFocus_sys()
|
||||
{
|
||||
Q_Q(QWidget);
|
||||
// Embedded native widget may have taken the focus; get it back to toplevel if that is the case
|
||||
// Embedded native widget may have taken the focus; get it back to toplevel
|
||||
// if that is the case (QTBUG-25852)
|
||||
const QWidget *topLevel = q->window();
|
||||
if (topLevel->windowType() != Qt::Popup) {
|
||||
// Do not activate in case the popup menu opens another application (QTBUG-70810).
|
||||
if (QGuiApplication::applicationState() == Qt::ApplicationActive
|
||||
&& topLevel->windowType() != Qt::Popup) {
|
||||
if (QWindow *nativeWindow = q->window()->windowHandle()) {
|
||||
if (nativeWindow != QGuiApplication::focusWindow()
|
||||
&& q->testAttribute(Qt::WA_WState_Created)) {
|
||||
|
Loading…
Reference in New Issue
Block a user