forked from qt-creator/qt-creator
ModelEditor: Improve performance of component model creation
Change-Id: I93ca27fc14692979314be90c0230d2672de66f04 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -133,6 +133,7 @@ private:
|
||||
private:
|
||||
qmt::ModelController *m_modelController = nullptr;
|
||||
QMultiHash<QString, Node> m_filePaths;
|
||||
QHash<QString, qmt::MComponent *> m_filePathComponentsMap;
|
||||
};
|
||||
|
||||
void UpdateIncludeDependenciesVisitor::setModelController(qmt::ModelController *modelController)
|
||||
@@ -322,10 +323,16 @@ void UpdateIncludeDependenciesVisitor::collectElementPaths(const ProjectExplorer
|
||||
|
||||
qmt::MComponent *UpdateIncludeDependenciesVisitor::findComponentFromFilePath(const QString &filePath)
|
||||
{
|
||||
const auto it = m_filePathComponentsMap.find(filePath);
|
||||
if (it != m_filePathComponentsMap.cend())
|
||||
return it.value();
|
||||
|
||||
FindComponentFromFilePath visitor;
|
||||
visitor.setFilePath(filePath);
|
||||
m_modelController->rootPackage()->accept(&visitor);
|
||||
return visitor.component();
|
||||
qmt::MComponent *component = visitor.component();
|
||||
m_filePathComponentsMap.insert(filePath, component);
|
||||
return component;
|
||||
}
|
||||
|
||||
bool UpdateIncludeDependenciesVisitor::haveDependency(const qmt::MObject *source,
|
||||
|
Reference in New Issue
Block a user