Commit e9d90710 authored by con's avatar con
Browse files

Fixes: - Restoring session doesn't end up with focus in editor

RevBy:    - dt
Details:  - ProjectWindow always grabbed the focus
parent 540c6de1
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtGui/QApplication>
#include <QtGui/QBoxLayout> #include <QtGui/QBoxLayout>
#include <QtGui/QComboBox> #include <QtGui/QComboBox>
#include <QtGui/QTabWidget> #include <QtGui/QTabWidget>
...@@ -190,7 +191,14 @@ void ProjectWindow::updateTreeWidget() ...@@ -190,7 +191,14 @@ void ProjectWindow::updateTreeWidget()
// That one runs fully thorough and deletes all widgets, even that one that we are currently removing // That one runs fully thorough and deletes all widgets, even that one that we are currently removing
// from m_panelsTabWidget. // from m_panelsTabWidget.
// To prevent that, we simply prevent the focus switching.... // To prevent that, we simply prevent the focus switching....
m_treeWidget->setFocus(); QWidget *focusWidget = qApp->focusWidget();
while (focusWidget) {
if (focusWidget == this) {
m_treeWidget->setFocus();
break;
}
focusWidget = focusWidget->parentWidget();
}
m_treeWidget->clear(); m_treeWidget->clear();
foreach(Project *project, m_session->projects()) { foreach(Project *project, m_session->projects()) {
......
...@@ -628,8 +628,10 @@ bool SessionManager::loadImpl(const QString &fileName) ...@@ -628,8 +628,10 @@ bool SessionManager::loadImpl(const QString &fileName)
if (success) { if (success) {
// restore the active mode // restore the active mode
const QString &modeIdentifier = value(QLatin1String("ActiveMode")).toString(); const QString &modeIdentifier = value(QLatin1String("ActiveMode")).toString();
if (!modeIdentifier.isEmpty()) if (!modeIdentifier.isEmpty()) {
m_core->modeManager()->activateMode(modeIdentifier); m_core->modeManager()->activateMode(modeIdentifier);
m_core->modeManager()->setFocusToCurrentMode();
}
} }
if (debug) if (debug)
......
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