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>
This commit is contained in:
Tor Arne Vestbø 2014-10-15 17:36:55 +02:00
parent 3ab4e869e2
commit 0f98d36ff6

View File

@ -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();
}
};