summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-05-05 10:26:48 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-05-05 11:22:39 (GMT)
commit8d96a5510cb433371a0e8686f20f1a39c0a286d3 (patch)
treeca8623cc28c150736cacf42a2b6d32996763c6c4
parentc03a4544fa3c1400fef3f1ad847bc3c65e660de7 (diff)
downloadQt-8d96a5510cb433371a0e8686f20f1a39c0a286d3.zip
Qt-8d96a5510cb433371a0e8686f20f1a39c0a286d3.tar.gz
Qt-8d96a5510cb433371a0e8686f20f1a39c0a286d3.tar.bz2
On Windows loosing focus should result in clearing focus if widget is embedded somewhere.
If a widget is embedded to non-Qt window on Windows, then we should still clear the focus whenever we receive WM_KILLFOCUS since we won't get WM_ACTIVATEAPP in this case. This is an addition to 6ed196051d0f19bfe2d045eaf12f5f5ca30670d0 Task-number: 251259 Reviewed-by: Thierry
-rw-r--r--src/gui/kernel/qapplication_win.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index fae0335..bc32c14 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -2432,10 +2432,12 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
widget = (QETWidget*)qApp->focusWidget();
HWND focus = ::GetFocus();
//if there is a current widget and the new widget belongs to the same toplevel window
+ //or if the current widget was embedded into non-qt window (i.e. we won't get WM_ACTIVATEAPP)
//then we clear the focus on the widget
//in case the new widget belongs to a different widget hierarchy, clearing the focus
//will be handled because the active window will change
- if (widget && ::IsChild(widget->window()->internalWinId(), focus)) {
+ const bool embedded = widget && ((QETWidget*)widget->window())->topData()->embedded;
+ if (widget && (embedded || ::IsChild(widget->window()->internalWinId(), focus))) {
widget->clearFocus();
result = true;
} else {