From 0f98d36ff6f01a91f32e9c3359882b6a856da8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 15 Oct 2014 17:36:55 +0200 Subject: Clear specific QWindow::focusObject() on QWindowPrivate::clearFocusObject() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/widgets/kernel/qwidgetwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/widgets/kernel/qwidgetwindow.cpp') 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(); } }; -- cgit v1.2.1