QbsProjectManager: Run updateAfterParse() also on add/remove file

Adding and removing files via the project tree is essentially the same
thing as doing it by editing a project file, except that no reparsing is
necessary.

Task-number: QTCREATORBUG-19292
Change-Id: Idb1bcf0e183f34d4de513f69f974e45ac91afeeb
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Christian Kandeler
2017-11-14 14:19:52 +01:00
parent 951f0e0bbd
commit b289a3f87a
2 changed files with 8 additions and 3 deletions

View File

@@ -275,7 +275,7 @@ bool QbsProject::addFilesToProduct(const QStringList &filePaths,
} }
if (notAdded->count() != filePaths.count()) { if (notAdded->count() != filePaths.count()) {
m_projectData = m_qbsProject.projectData(); m_projectData = m_qbsProject.projectData();
rebuildProjectTree(); delayedUpdateAfterParse();
} }
return notAdded->isEmpty(); return notAdded->isEmpty();
} }
@@ -302,8 +302,7 @@ bool QbsProject::removeFilesFromProduct(const QStringList &filePaths,
} }
if (notRemoved->count() != filePaths.count()) { if (notRemoved->count() != filePaths.count()) {
m_projectData = m_qbsProject.projectData(); m_projectData = m_qbsProject.projectData();
rebuildProjectTree(); delayedUpdateAfterParse();
emit fileListChanged();
} }
return notRemoved->isEmpty(); return notRemoved->isEmpty();
} }
@@ -472,6 +471,11 @@ void QbsProject::updateAfterParse()
emit fileListChanged(); emit fileListChanged();
} }
void QbsProject::delayedUpdateAfterParse()
{
QTimer::singleShot(0, this, &QbsProject::updateAfterParse);
}
void QbsProject::updateProjectNodes() void QbsProject::updateProjectNodes()
{ {
OpTimer opTimer("updateProjectNodes"); OpTimer opTimer("updateProjectNodes");

View File

@@ -136,6 +136,7 @@ private:
void handleRuleExecutionDone(); void handleRuleExecutionDone();
bool checkCancelStatus(); bool checkCancelStatus();
void updateAfterParse(); void updateAfterParse();
void delayedUpdateAfterParse();
void updateProjectNodes(); void updateProjectNodes();
void projectLoaded() override; void projectLoaded() override;