diff options
author | con <[email protected]> | 2008-12-10 16:48:28 +0100 |
---|---|---|
committer | con <[email protected]> | 2008-12-10 16:48:40 +0100 |
commit | e9d90710099376d585b73a872be62889b0fd24da (patch) | |
tree | 4e1aaf812072f6da3676b9cb8809467adf477fe3 /src/plugins | |
parent | 540c6de10830326c89da4f4c127551a97c2518a5 (diff) |
Fixes: - Restoring session doesn't end up with focus in editor
RevBy: - dt
Details: - ProjectWindow always grabbed the focus
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/projectexplorer/projectwindow.cpp | 10 | ||||
-rw-r--r-- | src/plugins/projectexplorer/session.cpp | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index c725c915c9e..e6732387424 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -45,6 +45,7 @@ #include <coreplugin/icore.h> #include <QtCore/QDebug> +#include <QtGui/QApplication> #include <QtGui/QBoxLayout> #include <QtGui/QComboBox> #include <QtGui/QTabWidget> @@ -190,7 +191,14 @@ void ProjectWindow::updateTreeWidget() // That one runs fully thorough and deletes all widgets, even that one that we are currently removing // from m_panelsTabWidget. // 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(); foreach(Project *project, m_session->projects()) { diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index a9bded02c61..89716ce3f68 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -628,8 +628,10 @@ bool SessionManager::loadImpl(const QString &fileName) if (success) { // restore the active mode const QString &modeIdentifier = value(QLatin1String("ActiveMode")).toString(); - if (!modeIdentifier.isEmpty()) + if (!modeIdentifier.isEmpty()) { m_core->modeManager()->activateMode(modeIdentifier); + m_core->modeManager()->setFocusToCurrentMode(); + } } if (debug) |