forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user