diff options
author | Eike Ziller <eike.ziller@digia.com> | 2013-05-07 19:03:22 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2013-05-21 15:07:14 +0200 |
commit | c31c5612ab61ddee234df66e63da45f642ba515c (patch) | |
tree | d9e853a20c5f7bb71394224f5f2bd258ea1cb1a3 /src/plugins/coreplugin/documentmanager.cpp | |
parent | 2bfcb47d63a872b996ee6fe9166247eade44d552 (diff) | |
download | qt-creator-c31c5612ab61ddee234df66e63da45f642ba515c.tar.gz |
Allow nested IContexts and use it to give extra editor windows a context
The extra editor windows need to have editor manager context, otherwise
shortcuts (like ctrl+tab) do not work in them if e.g. projects mode is
active. Doing this via add/removeAdditionalContexts would be non-trivial
and error prone, so adding a context to the extra window is more
convenient. Since editors themselves already define a context, we need
to allow nesting of contexts.
Change-Id: I244eca53ebd665fd4d8fe7531e8ff701ed0b40b2
Reviewed-by: David Schulz <david.schulz@digia.com>
(cherry picked from commit deff0eb3c73e925be701564c500a2eaaf1f29ac7)
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'src/plugins/coreplugin/documentmanager.cpp')
-rw-r--r-- | src/plugins/coreplugin/documentmanager.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/plugins/coreplugin/documentmanager.cpp b/src/plugins/coreplugin/documentmanager.cpp index 63e460bd3b..cee77d0225 100644 --- a/src/plugins/coreplugin/documentmanager.cpp +++ b/src/plugins/coreplugin/documentmanager.cpp @@ -218,8 +218,8 @@ DocumentManager::DocumentManager(QMainWindow *mw) m_instance = this; connect(d->m_mainWindow, SIGNAL(windowActivated()), this, SLOT(mainWindowActivated())); - connect(ICore::instance(), SIGNAL(contextChanged(Core::IContext*,Core::Context)), - this, SLOT(syncWithEditor(Core::IContext*))); + connect(ICore::instance(), SIGNAL(contextChanged(QList<Core::IContext*>,Core::Context)), + this, SLOT(syncWithEditor(QList<Core::IContext*>))); readSettings(); } @@ -1061,15 +1061,20 @@ void DocumentManager::checkForReload() // dump(); } -void DocumentManager::syncWithEditor(Core::IContext *context) +void DocumentManager::syncWithEditor(const QList<Core::IContext *> &context) { - if (!context) + if (context.isEmpty()) return; Core::IEditor *editor = Core::EditorManager::currentEditor(); - if (editor && editor->widget() == context->widget() - && !editor->isTemporary()) - setCurrentFile(editor->document()->fileName()); + if (!editor || editor->isTemporary()) + return; + foreach (IContext *c, context) { + if (editor->widget() == c->widget()) { + setCurrentFile(editor->document()->fileName()); + break; + } + } } /*! |