forked from qt-creator/qt-creator
ModelEditor: Minor refactoring of ComponentViewController
Change-Id: I6c54c694e77b377b9c0d0d2a4abe41d6976ede09 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -344,7 +344,7 @@ void ComponentViewController::doCreateComponentModel(const QString &filePath, qm
|
||||
case CppTools::ProjectFile::CXXHeader:
|
||||
case CppTools::ProjectFile::ObjCHeader:
|
||||
case CppTools::ProjectFile::ObjCXXHeader:
|
||||
isSource = scanHeaders && !isProxyHeader(file);
|
||||
isSource = scanHeaders && !d->pxnodeUtilities->isProxyHeader(file);
|
||||
break;
|
||||
case CppTools::ProjectFile::Unclassified:
|
||||
case CppTools::ProjectFile::Unsupported:
|
||||
@@ -374,20 +374,5 @@ void ComponentViewController::doCreateComponentModel(const QString &filePath, qm
|
||||
}
|
||||
}
|
||||
|
||||
bool ComponentViewController::isProxyHeader(const QString &file) const
|
||||
{
|
||||
CppTools::CppModelManager *cppModelManager = CppTools::CppModelManager::instance();
|
||||
CPlusPlus::Snapshot snapshot = cppModelManager->snapshot();
|
||||
|
||||
CPlusPlus::Document::Ptr document = snapshot.document(file);
|
||||
if (document) {
|
||||
QList<CPlusPlus::Document::Include> includes = document->resolvedIncludes();
|
||||
if (includes.count() != 1)
|
||||
return false;
|
||||
return QFileInfo(includes.at(0).resolvedFileName()).fileName() == QFileInfo(file).fileName();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ModelEditor
|
||||
|
||||
Reference in New Issue
Block a user