QbsProjectManager: Take the file type into account...

...when rebuilding the project tree.

Consider this product:
CppApplication { files: ["form.ui"] }

Now change it to this:
QtGuiApplication { files: ["form.ui"] }

The qbs file tags will now include "ui", so the Qt Creator
file type must change from "UnknownFileType" to "FormType". Therefore,
we need to replace the respective file node in the tree.

Change-Id: I6aa7e66d1af584e8ded2ffbb9b1215e8fc1135b8
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Christian Kandeler
2015-04-10 17:13:03 +02:00
parent 941356be76
commit 7da95de7b2

View File

@@ -519,10 +519,11 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root, const qbs::Gro
// Handle files: // Handle files:
if (c->isFile()) { if (c->isFile()) {
const ProjectExplorer::FileType newFileType = fileType(group, c->path());
ProjectExplorer::FileNode *fn = 0; ProjectExplorer::FileNode *fn = 0;
foreach (ProjectExplorer::FileNode *f, root->fileNodes()) { foreach (ProjectExplorer::FileNode *f, root->fileNodes()) {
// There can be one match only here! // There can be one match only here!
if (f->path() != path) if (f->path() != path || f->fileType() != newFileType)
continue; continue;
fn = f; fn = f;
break; break;
@@ -532,7 +533,7 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root, const qbs::Gro
if (updateExisting) if (updateExisting)
fn->emitNodeUpdated(); fn->emitNodeUpdated();
} else { } else {
fn = new ProjectExplorer::FileNode(path, fileType(group, c->path()), false); fn = new ProjectExplorer::FileNode(path, newFileType, false);
filesToAdd.append(fn); filesToAdd.append(fn);
} }
continue; continue;