Windows: Reject focus-in caused by reparenting Windows.

Calling WinAPI SetParent() causes the window to be activated, which
is not desired for native child widgets.

Task-number: QTBUG-32867
Change-Id: Idf61931bc425a043a4b7a98eec9ae122e234dc37
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
bb10
Friedemann Kleint 2014-04-25 13:27:06 +02:00 committed by The Qt Project
parent d032ff6388
commit ff77621469
1 changed files with 9 additions and 0 deletions

View File

@ -1063,6 +1063,15 @@ void QWindowsContext::handleFocusEvent(QtWindows::WindowsEventType et,
modalWindow->requestActivate();
return;
}
// QTBUG-32867: Invoking WinAPI SetParent() can cause focus-in for the
// window which is not desired for native child widgets.
if (platformWindow->testFlag(QWindowsWindow::WithinSetParent)) {
QWindow *currentFocusWindow = QGuiApplication::focusWindow();
if (currentFocusWindow && currentFocusWindow != platformWindow->window()) {
currentFocusWindow->requestActivate();
return;
}
}
nextActiveWindow = platformWindow->window();
} else {
// Focus out: Is the next window known and different