Commit d12527c2 authored by Eike Ziller's avatar Eike Ziller
Browse files

Fix escape key logic when design mode has output panes open



Task-number: QTCREATORBUG-9985

Change-Id: I6b22c92ac8f780b1a9469e9c2fd4a7cfecfef15f
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent 63f2e917
......@@ -854,7 +854,10 @@ 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)
// 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
......@@ -874,45 +877,55 @@ 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()) {
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);
}
}
}
void EditorManager::saveDocumentFromContextMenu()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment