macOS/iOS: set focus reason when handling window deactivation
Otherwise, the focusOutEvent to e.g. a QQuickItem losting focus will be OtherFocusReason when the window it's becomes inactive. Task-number: QTBUG-70319 Change-Id: Ic3762e68d92a88becd2b35612b14f6af64ee934e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>bb10
parent
062b50abff
commit
1337e8fe46
|
|
@ -1199,7 +1199,8 @@ void QCocoaWindow::windowDidBecomeKey()
|
|||
}
|
||||
|
||||
if (!windowIsPopupType())
|
||||
QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(window());
|
||||
QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(
|
||||
window(), Qt::ActiveWindowFocusReason);
|
||||
}
|
||||
|
||||
void QCocoaWindow::windowDidResignKey()
|
||||
|
|
@ -1217,7 +1218,8 @@ void QCocoaWindow::windowDidResignKey()
|
|||
if (!keyWindow || keyWindow == m_view.window) {
|
||||
// No new key window, go ahead and set the active window to zero
|
||||
if (!windowIsPopupType())
|
||||
QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(0);
|
||||
QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(
|
||||
nullptr, Qt::ActiveWindowFocusReason);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSViewMouseMoveHelper);
|
|||
if ([self isTransparentForUserInput])
|
||||
return NO;
|
||||
if (!m_platformWindow->windowIsPopupType())
|
||||
QWindowSystemInterface::handleWindowActivated([self topLevelWindow]);
|
||||
QWindowSystemInterface::handleWindowActivated([self topLevelWindow], Qt::ActiveWindowFocusReason);
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
|
|||
}
|
||||
|
||||
if (qGuiApp->focusWindow() != self.platformWindow->window())
|
||||
QWindowSystemInterface::handleWindowActivated(self.platformWindow->window());
|
||||
QWindowSystemInterface::handleWindowActivated(self.platformWindow->window(), Qt::ActiveWindowFocusReason);
|
||||
else
|
||||
qImDebug() << self.platformWindow->window() << "already active, not sending window activation";
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
|
|||
|
||||
UIResponder *newResponder = FirstResponderCandidate::currentCandidate();
|
||||
if ([self responderShouldTriggerWindowDeactivation:newResponder])
|
||||
QWindowSystemInterface::handleWindowActivated(0);
|
||||
QWindowSystemInterface::handleWindowActivated(nullptr, Qt::ActiveWindowFocusReason);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue