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

View File

@@ -386,8 +386,12 @@ void OutputPaneManager::slotHide()
m_buttons.value(idx)->setChecked(false);
if (m_pageMap.value(idx))
m_pageMap.value(idx)->visibilityChanged(false);
if (IEditor *editor = Core::EditorManager::instance()->currentEditor())
editor->widget()->setFocus();
if (IEditor *editor = Core::EditorManager::instance()->currentEditor()) {
QWidget *w = editor->widget()->focusWidget();
if (!w)
w = editor->widget();
w->setFocus();
}
}
}

View File

@@ -221,7 +221,10 @@ void CurrentDocumentFind::clearFindSupport()
bool CurrentDocumentFind::setFocusToCurrentFindSupport()
{
if (m_currentFind && m_currentWidget) {
m_currentWidget->setFocus();
QWidget *w = m_currentWidget->focusWidget();
if (!w)
w = m_currentWidget;
w->setFocus();
return true;
}
return false;