ModelManagerInterface Class | Extending Qt Creator Manual

Extending Qt Creator Manual | ModelManagerInterface

Extending Qt Creator Manual 4.4.1

# ModelManagerInterface Class

(QmlJS::ModelManagerInterface)

The ModelManagerInterface class acts as an interface to the global state of the QmlJS code model. More...

Header: | #include <ModelManagerInterface>

- List of all members, including inherited members

## Public Types

class | CppData
class | ProjectInfo
class | WorkingCopy
typedef | CppDataHash
typedef | CppDataHashIterator
enum | QrcResourceSelector { ActiveQrcResources, AllQrcResources }

## Public Functions

| ModelManagerInterface(QObject *parent = 0)
| ~ModelManagerInterface() override
void | activateScan()
QmlJS::QmlLanguageBundles | activeBundles() const
QList<ProjectInfo> | allProjectInfosForPath(const QString &path) const
LibraryInfo | builtins(const Document::Ptr &doc) const
ViewerContext | completeVContext(const ViewerContext &vCtx, const Document::Ptr &doc = Document::Ptr( 0 )) const
CppDataHash | cppData() const
virtual ProjectInfo | defaultProjectInfo() const
virtual ProjectInfo | defaultProjectInfoForProject(ProjectExplorer::Project *project) const
ViewerContext | defaultVContext(Dialect language = Dialect::Qml, const Document::Ptr &doc = Document::Ptr( 0 ), bool autoComplete = true) const
void | emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc)
QmlJS::Document::Ptr | ensuredGetDocumentForPath(const QString &filePath)
QmlJS::QmlLanguageBundles | extendedBundles() const
void | fileChangedOnDisk(const QString &path)
QStringList | filesAtQrcPath(const QString &path, const QLocale *locale = 0, ProjectExplorer::Project *project = 0, QrcResourceSelector resources = AllQrcResources)
QMap<QString, QStringList> | filesInQrcPath(const QString &path, const QLocale *locale = 0, ProjectExplorer::Project *project = 0, bool addDirs = false, QrcResourceSelector resources = AllQrcResources)
PathsAndLanguages | importPaths() const
bool | isIdle() const
void | joinAllThreads()
void | loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri, const QString &importVersion)
void | maybeQueueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc)
QmlJS::Snapshot | newestSnapshot() const
ProjectInfo | projectInfo(ProjectExplorer::Project *project, const ModelManagerInterface::ProjectInfo &defaultValue = ProjectInfo()) const
ProjectInfo | projectInfoForPath(const QString &path) const
QList<ProjectInfo> | projectInfos() const
QStringList | qrcPathsForFile(const QString &file, const QLocale *locale = 0, ProjectExplorer::Project *project = 0, QrcResourceSelector resources = AllQrcResources)
void | removeFiles(const QStringList &files)
void | removeProjectInfo(ProjectExplorer::Project *project)
virtual void | resetCodeModel()
void | setDefaultVContext(const ViewerContext &vContext)
QmlJS::Snapshot | snapshot() const
void | updateDocument(QmlJS::Document::Ptr doc)
void | updateLibraryInfo(const QString &path, const QmlJS::LibraryInfo &info)
void | updateProjectInfo(const ProjectInfo &pinfo, ProjectExplorer::Project *p)
void | updateQrcFile(const QString &path)
void | updateSourceFiles(const QStringList &files, bool emitDocumentOnDiskChanged)

## Signals

void | aboutToRemoveFiles(const QStringList &files)
void | documentChangedOnDisk(QmlJS::Document::Ptr doc)
void | documentUpdated(QmlJS::Document::Ptr doc)
void | libraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info)
void | projectInfoUpdated(const ProjectInfo &pinfo)
void | projectPathChanged(const QString &projectPath)

## Static Public Members

QStringList | globPatternsForLanguages(const QList<Dialect> languages)
Dialect | guessLanguageOfFile(const QString &fileName)
void | importScan(QFutureInterface<void> &future, WorkingCopy workingCopyInternal, PathsAndLanguages paths, ModelManagerInterface *modelManager, bool emitDocChangedOnDisk, bool libOnly = true, bool forceRescan = false)
ModelManagerInterface * | instance()
WorkingCopy | workingCopy()
void | writeWarning(const QString &msg)

## Protected Functions

virtual void | addTaskInternal(QFuture<void> result, const QString &msg, const char *taskId) const
void | asyncReset()
virtual QHash<QString, Dialect> | languageForSuffix() const
void | loadQmlTypeDescriptionsInternal(const QString &path)
void | maybeScan(const PathsAndLanguages &importPaths)
QMutex * | mutex() const
void | queueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc, bool scan)
QFuture<void> | refreshSourceFiles(const QStringList &sourceFiles, bool emitDocumentOnDiskChanged)
void | setDefaultProject(const ProjectInfo &pInfo, ProjectExplorer::Project *p)
virtual void | startCppQmlTypeUpdate()
void | updateImportPaths()
virtual WorkingCopy | workingCopyInternal() const
virtual void | writeMessageInternal(const QString &msg) const

## Static Protected Members

void | parse(QFutureInterface<void> &future, WorkingCopy workingCopyInternal, QStringList files, ModelManagerInterface *modelManager, QmlJS::Dialect mainLanguage, bool emitDocChangedOnDisk)
void | parseLoop(QSet<QString> &scannedPaths, QSet<QString> &newLibraries, WorkingCopy workingCopyInternal, QStringList files, ModelManagerInterface *modelManager, QmlJS::Dialect mainLanguage, bool emitDocChangedOnDisk, std::function<bool( qreal ) > reportProgress)
void | updateCppQmlTypes(QFutureInterface<void> &futureInterface, ModelManagerInterface *qmlModelManager, CPlusPlus::Snapshot snapshot, QHash<QString, QPair<CPlusPlus::Document::Ptr, bool> > documents)

## Detailed Description

The ModelManagerInterface class acts as an interface to the global state of the QmlJS code model.

The ModelManagerInterface is an interface for global state and actions in the QmlJS code model. It is implemented by QmlJSTools::Internal::ModelManager and the instance can be accessed through ModelManagerInterface::instance().

One of its primary concerns is to keep the Snapshots it maintains up to date by parsing documents and finding QML modules.

It has a Snapshot that contains only valid Documents, accessible through ModelManagerInterface::snapshot() and a Snapshot with potentially more recent, but invalid documents that is exposed through ModelManagerInterface::newestSnapshot().

See also QmlJS::Document, QmlJS::Snapshot, and QmlJSTools::Internal::ModelManager.

## Member Type Documentation

### typedef ModelManagerInterface::CppDataHash

### typedef ModelManagerInterface::CppDataHashIterator

### enum ModelManagerInterface::QrcResourceSelector

## Member Function Documentation

### ModelManagerInterface::ModelManagerInterface(QObject *parent = 0)

Default constructs an instance of ModelManagerInterface.

### ModelManagerInterface::~ModelManagerInterface()

Destroys the instance of ModelManagerInterface.

### `[signal]` void ModelManagerInterface::aboutToRemoveFiles(const QStringList &files)

### void ModelManagerInterface::activateScan()

### QmlJS::QmlLanguageBundles ModelManagerInterface::activeBundles() const

### `[virtual protected]` void ModelManagerInterface::addTaskInternal(QFuture<void> result, const QString &msg, const char *taskId) const

### QList<ProjectInfo> ModelManagerInterface::allProjectInfosForPath(const QString &path) const

Returns list of project infos for path

### `[protected]` void ModelManagerInterface::asyncReset()

### LibraryInfo ModelManagerInterface::builtins(const Document::Ptr &doc) const

### ViewerContext ModelManagerInterface::completeVContext(const ViewerContext &vCtx, const Document::Ptr &doc = Document::Ptr( 0 )) const

### CppDataHash ModelManagerInterface::cppData() const

### `[virtual]` ProjectInfo ModelManagerInterface::defaultProjectInfo() const

### `[virtual]` ProjectInfo ModelManagerInterface::defaultProjectInfoForProject(ProjectExplorer::Project *project) const

### ViewerContext ModelManagerInterface::defaultVContext(Dialect language = Dialect::Qml, const Document::Ptr &doc = Document::Ptr( 0 ), bool autoComplete = true) const

See also setDefaultVContext().

### `[signal]` void ModelManagerInterface::documentChangedOnDisk(QmlJS::Document::Ptr doc)

### `[signal]` void ModelManagerInterface::documentUpdated(QmlJS::Document::Ptr doc)

### void ModelManagerInterface::emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc)

### QmlJS::Document::Ptr ModelManagerInterface::ensuredGetDocumentForPath(const QString &filePath)

### QmlJS::QmlLanguageBundles ModelManagerInterface::extendedBundles() const

### void ModelManagerInterface::fileChangedOnDisk(const QString &path)

### QStringList ModelManagerInterface::filesAtQrcPath(const QString &path, const QLocale *locale = 0, ProjectExplorer::Project *project = 0, QrcResourceSelector resources = AllQrcResources)

### QMap<QString, QStringList> ModelManagerInterface::filesInQrcPath(const QString &path, const QLocale *locale = 0, ProjectExplorer::Project *project = 0, bool addDirs = false, QrcResourceSelector resources = AllQrcResources)

### `[static]` QStringList ModelManagerInterface::globPatternsForLanguages(const QList<Dialect> languages)

### `[static]` Dialect ModelManagerInterface::guessLanguageOfFile(const QString &fileName)

### PathsAndLanguages ModelManagerInterface::importPaths() const

### `[static]` void ModelManagerInterface::importScan(QFutureInterface<void> &future, WorkingCopy workingCopyInternal, PathsAndLanguages paths, ModelManagerInterface *modelManager, bool emitDocChangedOnDisk, bool libOnly = true, bool forceRescan = false)

### `[static]` ModelManagerInterface *ModelManagerInterface::instance()

### bool ModelManagerInterface::isIdle() const

### void ModelManagerInterface::joinAllThreads()

### `[virtual protected]` QHash<QString, Dialect> ModelManagerInterface::languageForSuffix() const

### `[signal]` void ModelManagerInterface::libraryInfoUpdated(const QString &path, const QmlJS::LibraryInfo &info)

### void ModelManagerInterface::loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri, const QString &importVersion)

### `[protected]` void ModelManagerInterface::loadQmlTypeDescriptionsInternal(const QString &path)

### void ModelManagerInterface::maybeQueueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc)

### `[protected]` void ModelManagerInterface::maybeScan(const PathsAndLanguages &importPaths)

### `[protected]` QMutex *ModelManagerInterface::mutex() const

### QmlJS::Snapshot ModelManagerInterface::newestSnapshot() const

### `[static protected]` void ModelManagerInterface::parse(QFutureInterface<void> &future, WorkingCopy workingCopyInternal, QStringList files, ModelManagerInterface *modelManager, QmlJS::Dialect mainLanguage, bool emitDocChangedOnDisk)

### `[static protected]` void ModelManagerInterface::parseLoop(QSet<QString> &scannedPaths, QSet<QString> &newLibraries, WorkingCopy workingCopyInternal, QStringList files, ModelManagerInterface *modelManager, QmlJS::Dialect mainLanguage, bool emitDocChangedOnDisk, std::function<bool( qreal ) > reportProgress)

### ProjectInfo ModelManagerInterface::projectInfo(ProjectExplorer::Project *project, const ModelManagerInterface::ProjectInfo &defaultValue = ProjectInfo()) const

### ProjectInfo ModelManagerInterface::projectInfoForPath(const QString &path) const

Returns project info with summarized info for path

Note: Project pointer will be empty

### `[signal]` void ModelManagerInterface::projectInfoUpdated(const ProjectInfo &pinfo)

### QList<ProjectInfo> ModelManagerInterface::projectInfos() const

### `[signal]` void ModelManagerInterface::projectPathChanged(const QString &projectPath)

### QStringList ModelManagerInterface::qrcPathsForFile(const QString &file, const QLocale *locale = 0, ProjectExplorer::Project *project = 0, QrcResourceSelector resources = AllQrcResources)

### `[protected]` void ModelManagerInterface::queueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc, bool scan)

### `[protected]` QFuture<void> ModelManagerInterface::refreshSourceFiles(const QStringList &sourceFiles, bool emitDocumentOnDiskChanged)

### void ModelManagerInterface::removeFiles(const QStringList &files)

### void ModelManagerInterface::removeProjectInfo(ProjectExplorer::Project *project)

### `[virtual]` void ModelManagerInterface::resetCodeModel()

### `[protected]` void ModelManagerInterface::setDefaultProject(const ProjectInfo &pInfo, ProjectExplorer::Project *p)

### void ModelManagerInterface::setDefaultVContext(const ViewerContext &vContext)

See also defaultVContext().

### QmlJS::Snapshot ModelManagerInterface::snapshot() const

### `[virtual protected]` void ModelManagerInterface::startCppQmlTypeUpdate()

### `[static protected]` void ModelManagerInterface::updateCppQmlTypes(QFutureInterface<void> &futureInterface, ModelManagerInterface *qmlModelManager, CPlusPlus::Snapshot snapshot, QHash<QString, QPair<CPlusPlus::Document::Ptr, bool> > documents)

### void ModelManagerInterface::updateDocument(QmlJS::Document::Ptr doc)

### `[protected]` void ModelManagerInterface::updateImportPaths()

### void ModelManagerInterface::updateLibraryInfo(const QString &path, const QmlJS::LibraryInfo &info)

### void ModelManagerInterface::updateProjectInfo(const ProjectInfo &pinfo, ProjectExplorer::Project *p)

### void ModelManagerInterface::updateQrcFile(const QString &path)

### void ModelManagerInterface::updateSourceFiles(const QStringList &files, bool emitDocumentOnDiskChanged)

### `[static]` WorkingCopy ModelManagerInterface::workingCopy()

### `[virtual protected]` WorkingCopy ModelManagerInterface::workingCopyInternal() const

### `[virtual protected]` void ModelManagerInterface::writeMessageInternal(const QString &msg) const

### `[static]` void ModelManagerInterface::writeWarning(const QString &msg)