summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/editormanager/editormanager.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2013-10-18 15:47:29 +0200
committerEike Ziller <eike.ziller@digia.com>2013-10-25 11:12:24 +0200
commitd12527c212ef7c104b067149794d99c5559e4eaa (patch)
treeb5a50362bb47bf30d4c2dd4bd004d683da0b7ffd /src/plugins/coreplugin/editormanager/editormanager.cpp
parent63f2e9177c29e0c85a6c9e8d7fcb8bce30933c31 (diff)
downloadqt-creator-d12527c212ef7c104b067149794d99c5559e4eaa.tar.gz
Fix escape key logic when design mode has output panes open
Task-number: QTCREATORBUG-9985 Change-Id: I6b22c92ac8f780b1a9469e9c2fd4a7cfecfef15f Reviewed-by: David Schulz <david.schulz@digia.com>
Diffstat (limited to 'src/plugins/coreplugin/editormanager/editormanager.cpp')
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp67
1 files changed, 40 insertions, 27 deletions
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index 93a7c3c739..073b89dc5b 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -854,10 +854,13 @@ static void setFocusToEditorViewAndUnmaximizePanes(EditorView *view)
void EditorManager::doEscapeKeyFocusMoveMagic()
{
// use cases to cover:
- // 1. if app focus is in mode or external window without editor view (e.g. Projects, ext. Help)
- // activate & raise the current editor view (can be external)
- // if that is in edit mode
- // activate edit mode and unmaximize output pane
+ // 1. if app focus is in mode or external window without editor view (e.g. Design, Projects, ext. Help)
+ // if there are extra views (e.g. output)
+ // hide them
+ // otherwise
+ // activate & raise the current editor view (can be external)
+ // if that is in edit mode
+ // activate edit mode and unmaximize output pane
// 2. if app focus is in external window with editor view
// hide find if necessary
// 2. if app focus is in mode with editor view
@@ -874,44 +877,54 @@ void EditorManager::doEscapeKeyFocusMoveMagic()
// otherwise (i.e. mode is edit mode)
// hide extra views (find, help, output)
+ QWidget *activeWindow = qApp->activeWindow();
+ if (!activeWindow)
+ return;
+ QWidget *focus = qApp->focusWidget();
EditorView *editorView = currentEditorView();
- bool editorViewActive = (qApp->focusWidget() == editorView->focusWidget());
+ bool editorViewActive = (focus && focus == editorView->focusWidget());
bool editorViewVisible = editorView->isVisible();
- if (!editorViewActive && editorViewVisible) {
- setFocusToEditorViewAndUnmaximizePanes(editorView);
- return;
- }
- if (!editorViewActive && !editorViewVisible) {
- // assumption is that editorView is in main window then
- ModeManager::activateMode(Id(Constants::MODE_EDIT));
- QTC_CHECK(editorView->isVisible());
- setFocusToEditorViewAndUnmaximizePanes(editorView);
- return;
- }
- if (editorViewActive) {
- QTC_CHECK(editorViewVisible);
+
+ if (!( editorViewVisible && !editorViewActive && editorView->window() == activeWindow )) {
bool stuffHidden = false;
QWidget *findPane = FindToolBarPlaceHolder::getCurrent();
- if (findPane && findPane->isVisibleTo(editorView)) {
+ if (findPane && findPane->isVisible() && findPane->window() == activeWindow) {
findPane->hide();
stuffHidden = true;
}
QWidget *outputPane = OutputPanePlaceHolder::getCurrent();
- if (outputPane && outputPane->isVisibleTo(editorView)) {
+ if (outputPane && outputPane->isVisible() && outputPane->window() == activeWindow) {
OutputPaneManager::instance()->slotHide();
stuffHidden = true;
}
QWidget *rightPane = RightPanePlaceHolder::current();
- if (rightPane && rightPane->isVisibleTo(editorView)) {
+ if (rightPane && rightPane->isVisible() && rightPane->window() == activeWindow) {
RightPaneWidget::instance()->setShown(false);
stuffHidden = true;
}
- if (!stuffHidden && editorView->window() == ICore::mainWindow()) {
- // we are in a editor view and there's nothing to hide, switch to edit
- ModeManager::activateMode(Id(Constants::MODE_EDIT));
- // next call works only because editor views in main window are shared between modes
- setFocusToEditorViewAndUnmaximizePanes(editorView);
- }
+ if (stuffHidden)
+ return;
+ }
+
+ if (!editorViewActive && editorViewVisible) {
+ setFocusToEditorViewAndUnmaximizePanes(editorView);
+ return;
+ }
+
+ if (!editorViewActive && !editorViewVisible) {
+ // assumption is that editorView is in main window then
+ ModeManager::activateMode(Id(Constants::MODE_EDIT));
+ QTC_CHECK(editorView->isVisible());
+ setFocusToEditorViewAndUnmaximizePanes(editorView);
+ return;
+ }
+
+ if (editorView->window() == ICore::mainWindow()) {
+ // we are in a editor view and there's nothing to hide, switch to edit
+ ModeManager::activateMode(Id(Constants::MODE_EDIT));
+ QTC_CHECK(editorView->isVisible());
+ // next call works only because editor views in main window are shared between modes
+ setFocusToEditorViewAndUnmaximizePanes(editorView);
}
}