More Esc fixes.

Move focus back to editor's focus widget if there's one.
(E.g. pressing escape in an output pane while the
commit editor is open.)

Change-Id: I4211a84cfa3d7ee9b61f39ae054fc4bd32e214c1
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Eike Ziller
2011-12-01 13:03:08 +01:00
parent 67ab31c224
commit 5f44d8f535
3 changed files with 15 additions and 5 deletions

View File

@@ -897,8 +897,11 @@ void MainWindow::setFocusToEditor()
// give focus to the editor if we have one
if (IEditor *editor = m_editorManager->currentEditor()) {
if (qApp->focusWidget() != editor->widget()->focusWidget()) {
editor->widget()->setFocus();
focusWasMovedToEditor = editor->widget()->hasFocus();
QWidget *w = editor->widget()->focusWidget();
if (!w)
w = editor->widget();
w->setFocus();
focusWasMovedToEditor = w->hasFocus();
}
}