diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 41182568c37..52b2d7a2748 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -2053,7 +2053,7 @@ void EditorManager::updateActions() { IEditor *curEditor = currentEditor(); const QString fileName = fileNameForEditor(curEditor); - int openedCount = openedEditors().count() + d->m_editorModel->restoredEditors().count(); + int openedCount = d->m_editorModel->openDocumentCount(); if (curEditor) { if (HostOsInfo::isMacHost()) diff --git a/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp b/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp index a9a31838312..aa226066a3f 100644 --- a/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorsmodel.cpp @@ -295,6 +295,11 @@ QModelIndex OpenEditorsModel::index(int row, int column, const QModelIndex &pare return createIndex(row, column); } +int OpenEditorsModel::openDocumentCount() const +{ + return d->m_editors.count(); +} + QVariant OpenEditorsModel::data(const QModelIndex &index, int role) const { if (!index.isValid() || (index.column() != 0 && role < Qt::UserRole)) diff --git a/src/plugins/coreplugin/editormanager/openeditorsmodel.h b/src/plugins/coreplugin/editormanager/openeditorsmodel.h index 61c29c59099..01d8aec3110 100644 --- a/src/plugins/coreplugin/editormanager/openeditorsmodel.h +++ b/src/plugins/coreplugin/editormanager/openeditorsmodel.h @@ -60,6 +60,8 @@ public: int rowCount(const QModelIndex &parent = QModelIndex()) const; QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; + int openDocumentCount() const; + void addEditor(IEditor *editor, bool isDuplicate = false); void addRestoredEditor(const QString &fileName, const QString &displayName, const Id &id); QModelIndex firstRestoredEditor() const; diff --git a/src/plugins/qmldesigner/shortcutmanager.cpp b/src/plugins/qmldesigner/shortcutmanager.cpp index 1a56e4f22a8..37d98e95d58 100644 --- a/src/plugins/qmldesigner/shortcutmanager.cpp +++ b/src/plugins/qmldesigner/shortcutmanager.cpp @@ -172,8 +172,7 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex void ShortCutManager::updateActions(Core::IEditor* currentEditor) { - int openedCount = Core::ICore::editorManager()->openedEditors().count() - + Core::ICore::editorManager()->openedEditorsModel()->restoredEditors().count(); + int openedCount = Core::ICore::editorManager()->openedEditorsModel()->openDocumentCount(); QString fileName; if (currentEditor) {