Suppress "Click to focus" for widget windows.

Calling requestActivate() on native child widgets
can cause focus problems (keyboard input going to
widgets that don't handle it,etc).

Breakage introduced by:
4675681b5e88b178adbdef775ac6a4b1e573458 .

Task-number: QTBUG-30922

Change-Id: I4efdfef6bffc89fe62156d248f05ed99c58bf794
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
bb10
Friedemann Kleint 2013-05-22 13:26:31 +02:00 committed by The Qt Project
parent 8078a04e19
commit 15fbc0112d
1 changed files with 2 additions and 2 deletions

View File

@ -237,8 +237,8 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
platformWindow->setFlag(QWindowsWindow::AutoMouseCapture);
if (QWindowsContext::verboseEvents)
qDebug() << "Automatic mouse capture " << window;
// Implement "Click to focus" for native child windows.
if (!window->isTopLevel() && QGuiApplication::focusWindow() != window)
// Implement "Click to focus" for native child windows (unless it is a native widget window).
if (!window->isTopLevel() && !window->inherits("QWidgetWindow") && QGuiApplication::focusWindow() != window)
window->requestActivate();
} else if (platformWindow->hasMouseCapture()
&& platformWindow->testFlag(QWindowsWindow::AutoMouseCapture)