Extending Qt Creator Manual | Context

Extending Qt Creator Manual 4.7.2

# Context Class

(QmlJS::Context)

The Context class holds information about relationships between documents in a Snapshot. More...

Header: | #include <Context>

- List of all members, including inherited members

## Public Functions

| ~Context()
QString | defaultPropertyName(const QmlJS::ObjectValue *object) const
const QmlJS::Imports * | imports(const QmlJS::Document *doc) const
const QmlJS::Value * | lookupReference(const QmlJS::Value *value) const
const QmlJS::ObjectValue * | lookupType(const QmlJS::Document *doc, AST::UiQualifiedId *qmlTypeName, AST::UiQualifiedId *qmlTypeNameEnd = 0) const
const QmlJS::ObjectValue * | lookupType(const QmlJS::Document *doc, const QStringList &qmlTypeName) const
QmlJS::ContextPtr | ptr() const
QmlJS::Snapshot | snapshot() const
QmlJS::ValueOwner * | valueOwner() const
QmlJS::ViewerContext | viewerContext() const

## Static Public Members

QmlJS::ContextPtr | create(const QmlJS::Snapshot &snapshot, QmlJS::ValueOwner *valueOwner, const int &imports, const QmlJS::ViewerContext &viewerContext)

## Detailed Description

The Context class holds information about relationships between documents in a Snapshot.

Contexts are usually created through Link. Once created, a Context is immutable and can be freely shared between threads.

Their main purpose is to allow lookup of types with lookupType() and resolving of references through lookupReference(). As such, they form the basis for creating a ScopeChain.

Information about the imports of a Document can be accessed with imports().

When dealing with a QmlJSEditor::QmlJSEditorDocument it is unnecessary to construct a new Context manually. Instead use QmlJSEditorDocument::semanticInfo()::context.

See also Document, Link, and Snapshot.

## Member Function Documentation

### Context::~Context()

Destroys the instance of Context.

### `[static]` QmlJS::ContextPtr Context::create(const QmlJS::Snapshot &snapshot, QmlJS::ValueOwner *valueOwner, const int &imports, const QmlJS::ViewerContext &viewerContext)

### QString Context::defaultPropertyName(const QmlJS::ObjectValue *object) const

### const QmlJS::Imports *Context::imports(const QmlJS::Document *doc) const

### const QmlJS::Value *Context::lookupReference(const QmlJS::Value *value) const

### const QmlJS::ObjectValue *Context::lookupType(const QmlJS::Document *doc, AST::UiQualifiedId *qmlTypeName, AST::UiQualifiedId *qmlTypeNameEnd = 0) const

### const QmlJS::ObjectValue *Context::lookupType(const QmlJS::Document *doc, const QStringList &qmlTypeName) const

### QmlJS::ContextPtr Context::ptr() const

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

### QmlJS::ValueOwner *Context::valueOwner() const

### QmlJS::ViewerContext Context::viewerContext() const