diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-06-18 16:22:42 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-06-20 14:40:32 +0000 |
commit | a3d6839162526b1a7b92f235de0608435e01b461 (patch) | |
tree | aec351c540f500caaa7d0290cce5f694a67a74df /src/plugins | |
parent | d6d133da42b290183fdefdd080c8b492c3db0227 (diff) | |
download | qt-creator-a3d6839162526b1a7b92f235de0608435e01b461.tar.gz |
Project: Delay acting on fileListChanged signal
This gives the UI a bit more opportunity to render after the project was
parsed.
Change-Id: Ie316f1c69cb0ebb856943a094b81b55f1aa2317a
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/beautifier/beautifierplugin.cpp | 10 | ||||
-rw-r--r-- | src/plugins/designer/resourcehandler.cpp | 6 | ||||
-rw-r--r-- | src/plugins/modeleditor/modelindexer.cpp | 7 | ||||
-rw-r--r-- | src/plugins/qtsupport/qtoutputformatter.cpp | 7 |
4 files changed, 23 insertions, 7 deletions
diff --git a/src/plugins/beautifier/beautifierplugin.cpp b/src/plugins/beautifier/beautifierplugin.cpp index 798724d185..598d5a2388 100644 --- a/src/plugins/beautifier/beautifierplugin.cpp +++ b/src/plugins/beautifier/beautifierplugin.cpp @@ -43,6 +43,7 @@ #include <coreplugin/messagemanager.h> #include <cppeditor/cppeditorconstants.h> #include <projectexplorer/project.h> +#include <projectexplorer/projectnodes.h> #include <projectexplorer/projecttree.h> #include <texteditor/formattexteditor.h> #include <texteditor/textdocument.h> @@ -50,13 +51,13 @@ #include <texteditor/texteditor.h> #include <texteditor/texteditorconstants.h> #include <utils/algorithm.h> -#include <utils/textutils.h> #include <utils/fileutils.h> #include <utils/mimetypes/mimedatabase.h> #include <utils/qtcassert.h> #include <utils/runextensions.h> #include <utils/synchronousprocess.h> #include <utils/temporarydirectory.h> +#include <utils/textutils.h> #include <QDir> #include <QFileInfo> @@ -161,7 +162,12 @@ void BeautifierPluginPrivate::autoFormatOnSave(Core::IDocument *document) // Check if file is contained in the current project (if wished) if (m_generalSettings->autoFormatOnlyCurrentProject()) { const ProjectExplorer::Project *pro = ProjectExplorer::ProjectTree::currentProject(); - if (!pro || !pro->isKnownFile(document->filePath())) { + if (!pro + || pro->files([document](const ProjectExplorer::Node *n) { + return ProjectExplorer::Project::SourceFiles(n) + && n->filePath() == document->filePath(); + }) + .isEmpty()) { return; } } diff --git a/src/plugins/designer/resourcehandler.cpp b/src/plugins/designer/resourcehandler.cpp index 0f7029a0e2..db48e63502 100644 --- a/src/plugins/designer/resourcehandler.cpp +++ b/src/plugins/designer/resourcehandler.cpp @@ -56,7 +56,11 @@ void ResourceHandler::ensureInitialized() m_initialized = true; auto connector = [this](Project *p) { - connect(p, &Project::fileListChanged, this, &ResourceHandler::updateResources); + connect(p, + &Project::fileListChanged, + this, + &ResourceHandler::updateResources, + Qt::QueuedConnection); }; for (Project *p : SessionManager::projects()) diff --git a/src/plugins/modeleditor/modelindexer.cpp b/src/plugins/modeleditor/modelindexer.cpp index e03fb4eb03..71358c2657 100644 --- a/src/plugins/modeleditor/modelindexer.cpp +++ b/src/plugins/modeleditor/modelindexer.cpp @@ -370,8 +370,11 @@ QString ModelIndexer::findDiagram(const qmt::Uid &modelUid, const qmt::Uid &diag void ModelIndexer::onProjectAdded(ProjectExplorer::Project *project) { - connect(project, &ProjectExplorer::Project::fileListChanged, - this, [=]() { this->onProjectFileListChanged(project); }); + connect(project, + &ProjectExplorer::Project::fileListChanged, + this, + [=]() { this->onProjectFileListChanged(project); }, + Qt::QueuedConnection); scanProject(project); } diff --git a/src/plugins/qtsupport/qtoutputformatter.cpp b/src/plugins/qtsupport/qtoutputformatter.cpp index 1bffe659cc..613dddef4c 100644 --- a/src/plugins/qtsupport/qtoutputformatter.cpp +++ b/src/plugins/qtsupport/qtoutputformatter.cpp @@ -89,8 +89,11 @@ QtOutputFormatter::QtOutputFormatter(Project *project) d->projectFinder.setProjectFiles(project->files(Project::SourceFiles)); d->projectFinder.setProjectDirectory(project->projectDirectory()); - connect(project, &Project::fileListChanged, - this, &QtOutputFormatter::updateProjectFileList); + connect(project, + &Project::fileListChanged, + this, + &QtOutputFormatter::updateProjectFileList, + Qt::QueuedConnection); } } |