ProjectExplorer: Add and use addNestedNode(...) that takes unique_ptr

Change-Id: Ieb26721d053111fb350494e31d1f6da3fe642420
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Tobias Hunger
2018-04-26 15:07:56 +02:00
parent f9585d939f
commit d332954567
10 changed files with 44 additions and 39 deletions

View File

@@ -73,10 +73,9 @@ void setupArtifacts(ProjectExplorer::FolderNode *root, const QList<qbs::Artifact
QLatin1String("linkerscript"),
QLatin1String("qrc"), QLatin1String("java.java")
};
ProjectExplorer::FileNode * const node
= new ProjectExplorer::FileNode(path, type, isGenerated);
auto node = std::make_unique<ProjectExplorer::FileNode>(path, type, isGenerated);
node->setListInProject(!isGenerated || ad.fileTags().toSet().intersects(sourceTags));
root->addNestedNode(node);
root->addNestedNode(std::move(node));
}
root->compress();
}
@@ -222,7 +221,7 @@ std::unique_ptr<QbsRootProjectNode> QbsNodeTreeBuilder::buildTree(QbsProject *pr
for (const QString &f : files) {
const Utils::FileName filePath = Utils::FileName::fromString(f);
if (filePath.isChildOf(base))
buildSystemFiles->addNestedNode(new ProjectExplorer::FileNode(filePath, ProjectExplorer::FileType::Project, false));
buildSystemFiles->addNestedNode(std::make_unique<ProjectExplorer::FileNode>(filePath, ProjectExplorer::FileType::Project, false));
}
buildSystemFiles->compress();
root->addNode(buildSystemFiles);