diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-12-06 10:58:59 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-12-08 09:56:29 +0000 |
commit | f542e24eca61cc77616938c9bd03bfee97845473 (patch) | |
tree | 6163186e7ba0889e5cd98611bc797370bdb7ba6a /src/plugins/qmljstools/qmljsmodelmanager.cpp | |
parent | 18f38ff18ee0b4be28d6c904bf0ebf97b364b149 (diff) |
Project: Make Project::file take a std::function to match files
Make Project::files take a standard function to match files with instead
of an enum (and a std::function).
Change-Id: I6a24e40dba0e972ff96c0a57e775d2377e2545e0
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/qmljstools/qmljsmodelmanager.cpp')
-rw-r--r-- | src/plugins/qmljstools/qmljsmodelmanager.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index de9259933ff..4da912cc90c 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -86,14 +86,13 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject( Constants::QMLPROJECT_MIMETYPE, Constants::QMLTYPES_MIMETYPE, Constants::QMLUI_MIMETYPE }; - projectInfo.sourceFiles = Utils::transform(project->files(Project::SourceFiles, - [&qmlTypeNames](const Node *n) { - if (const FileNode *fn = n->asFileNode()) { - return fn->fileType() == FileType::QML - && qmlTypeNames.contains(Utils::mimeTypeForFile(fn->filePath().toString(), - MimeMatchMode::MatchExtension).name()); - } - return false; + projectInfo.sourceFiles = Utils::transform(project->files([&qmlTypeNames](const Node *n) { + if (!Project::SourceFiles(n)) + return false; + const FileNode *fn = n->asFileNode(); + return fn && fn->fileType() == FileType::QML + && qmlTypeNames.contains(Utils::mimeTypeForFile(fn->filePath().toString(), + MimeMatchMode::MatchExtension).name()); }), &FileName::toString); activeTarget = project->activeTarget(); } |