forked from qt-creator/qt-creator
ProjectExplorer: Add a FolderNode::addNestedNode() function
Also, rename buildTree() to addNestedNodes(), it's really adding things, not recompletely (re-)building the subtree. Use it whenever possible to avoid intermediate lists of items to insert. Change-Id: I5fde41e5b164a8a292410bd381a85f5efadf3471 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -384,17 +384,15 @@ Project::RestoreResult QmlProject::fromMap(const QVariantMap &map, QString *erro
|
||||
|
||||
void QmlProject::generateProjectTree()
|
||||
{
|
||||
QStringList allFiles = files();
|
||||
auto newRoot = new Internal::QmlProjectNode(this);
|
||||
|
||||
QList<FileNode *> fileNodes = Utils::transform(allFiles, [this](const QString &f) {
|
||||
for (const QString &f : files()) {
|
||||
FileType fileType = FileType::Source; // ### FIXME
|
||||
if (f == projectFilePath().toString())
|
||||
fileType = FileType::Project;
|
||||
return new FileNode(Utils::FileName::fromString(f), fileType, false);
|
||||
});
|
||||
newRoot->addNestedNode(new FileNode(Utils::FileName::fromString(f), fileType, false));
|
||||
}
|
||||
|
||||
auto newRoot = new Internal::QmlProjectNode(this);
|
||||
newRoot->buildTree(fileNodes);
|
||||
setRootProjectNode(newRoot);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user