diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-10-15 17:36:55 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-10-20 11:42:48 +0200 |
commit | 0f98d36ff6f01a91f32e9c3359882b6a856da8a0 (patch) | |
tree | 6972003edab679bfac2b00cfd3442c9f2259bd9a /src/widgets/kernel/qwidgetwindow.cpp | |
parent | 3ab4e869e205ecd9bbce46281d6c1cc74da94228 (diff) |
Clear specific QWindow::focusObject() on QWindowPrivate::clearFocusObject()
The focusObject of a QWidgetWindow is the focusWidget() of the top level
widget, so when clearing the focus object of the window we should clear
focus of the same focusWidget, not the application-wide focus widget,
which may live in another window.
Change-Id: Ib9162418865c225e23aac7987e119b3b651983eb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/widgets/kernel/qwidgetwindow.cpp')
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index cd57c1611e..d40fc84d77 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -73,8 +73,10 @@ public: void clearFocusObject() { - if (QApplicationPrivate::focus_widget) - QApplicationPrivate::focus_widget->clearFocus(); + Q_Q(QWidgetWindow); + QWidget *widget = q->widget(); + if (widget && widget->focusWidget()) + widget->focusWidget()->clearFocus(); } }; |