Commit bbfc1013 authored by con's avatar con
Browse files

Fixes: "Return to editor" functionality suboptimal in debug mode

parent 7b38d9c8
...@@ -803,10 +803,7 @@ void MainWindow::openFiles(const QStringList &fileNames) ...@@ -803,10 +803,7 @@ void MainWindow::openFiles(const QStringList &fileNames)
void MainWindow::setFocusToEditor() void MainWindow::setFocusToEditor()
{ {
QWidget *focusWidget = qApp->focusWidget(); QWidget *focusWidget = qApp->focusWidget();
// ### Duplicated code from EditMode::makeSureEditorManagerVisible if (!EditorManager::instance()->isVisible())
IMode *currentMode = m_coreImpl->modeManager()->currentMode();
if (currentMode && currentMode->uniqueModeName() != QLatin1String(Constants::MODE_EDIT) &&
currentMode->uniqueModeName() != QLatin1String("GdbDebugger.Mode.Debug"))
{ {
m_coreImpl->modeManager()->activateMode(QLatin1String(Constants::MODE_EDIT)); m_coreImpl->modeManager()->activateMode(QLatin1String(Constants::MODE_EDIT));
} }
...@@ -814,11 +811,23 @@ void MainWindow::setFocusToEditor() ...@@ -814,11 +811,23 @@ void MainWindow::setFocusToEditor()
if (IEditor *editor = m_editorManager->currentEditor()) if (IEditor *editor = m_editorManager->currentEditor())
editor->widget()->setFocus(); editor->widget()->setFocus();
if (focusWidget && focusWidget == qApp->focusWidget()) { bool focusWasAlreadyInEditor = (focusWidget && focusWidget == qApp->focusWidget());
if (FindToolBarPlaceHolder::getCurrent()) if (focusWasAlreadyInEditor) {
FindToolBarPlaceHolder::getCurrent()->hide(); bool stuffVisible =
OutputPaneManager::instance()->slotHide(); (FindToolBarPlaceHolder::getCurrent() &&
RightPaneWidget::instance()->setShown(false); FindToolBarPlaceHolder::getCurrent()->isVisible())
|| (OutputPanePlaceHolder::getCurrent() &&
OutputPanePlaceHolder::getCurrent()->isVisible())
|| (RightPanePlaceHolder::current() &&
RightPanePlaceHolder::current()->isVisible());
if (stuffVisible) {
if (FindToolBarPlaceHolder::getCurrent())
FindToolBarPlaceHolder::getCurrent()->hide();
OutputPaneManager::instance()->slotHide();
RightPaneWidget::instance()->setShown(false);
} else {
m_coreImpl->modeManager()->activateMode(QLatin1String(Constants::MODE_EDIT));
}
} }
} }
......
Supports Markdown
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