From 7140642d0eeb05b4bcd6da1abaf493ad27ee41ae Mon Sep 17 00:00:00 2001 From: Yuchen Deng Date: Mon, 21 Nov 2011 15:35:21 +0800 Subject: [PATCH] Fix central Esc handling again We should to determine the focus widget whether the same, Sometimes, the widget's sub-window has the real focus. Change-Id: I0e9128e7d6008e2cb6de681bb0a1a337ad69a230 Reviewed-by: Eike Ziller --- src/plugins/coreplugin/mainwindow.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index f4512c1f7c9..d1c6334ecf1 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -896,7 +896,7 @@ void MainWindow::setFocusToEditor() // give focus to the editor if we have one if (IEditor *editor = m_editorManager->currentEditor()) { - if (qApp->focusWidget() != editor->widget()) { + if (qApp->focusWidget() != editor->widget()->focusWidget()) { editor->widget()->setFocus(); focusWasMovedToEditor = editor->widget()->hasFocus(); } @@ -913,7 +913,6 @@ void MainWindow::setFocusToEditor() if (focusWasMovedToEditor) return; - // check for some visible bar which we want to hide bool stuffVisible = (FindToolBarPlaceHolder::getCurrent() && @@ -932,7 +931,6 @@ void MainWindow::setFocusToEditor() // switch to edit mode if necessary m_coreImpl->modeManager()->activateMode(QLatin1String(Constants::MODE_EDIT)); - } void MainWindow::showNewItemDialog(const QString &title,