diff options
author | Eike Ziller <eike.ziller@nokia.com> | 2011-12-01 13:03:08 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@nokia.com> | 2011-12-02 12:34:39 +0100 |
commit | 5f44d8f5354ff5b192f8cdf88a85a81a218f733c (patch) | |
tree | a62c64698239dedb458516775e2877d1877b7724 /src | |
parent | 67ab31c224d2c7628e5fdd19df77378af6d0b13a (diff) | |
download | qt-creator-5f44d8f5354ff5b192f8cdf88a85a81a218f733c.tar.gz |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/coreplugin/mainwindow.cpp | 7 | ||||
-rw-r--r-- | src/plugins/coreplugin/outputpanemanager.cpp | 8 | ||||
-rw-r--r-- | src/plugins/find/currentdocumentfind.cpp | 5 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index d1c6334ecf..0232298083 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -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(); } } diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index f4d7c5a9c4..29e15e718d 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -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(); + } } } diff --git a/src/plugins/find/currentdocumentfind.cpp b/src/plugins/find/currentdocumentfind.cpp index acbed55a96..6f4175416c 100644 --- a/src/plugins/find/currentdocumentfind.cpp +++ b/src/plugins/find/currentdocumentfind.cpp @@ -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; |