Extending Qt Creator Manual | AssistInterface

Extending Qt Creator Manual 4.5.2

# AssistInterface Class

(TextEditor::AssistInterface)

The AssistInterface class acts as an interface for providing access to the document from which a proposal is computed. More...

Header: | #include <AssistInterface>

- List of all members, including inherited members

## Public Functions

| AssistInterface(QTextDocument *textDocument, int position, const QString &fileName, AssistReason reason)
virtual | ~AssistInterface()
virtual QChar | characterAt(int position) const
virtual QString | fileName() const
virtual int | position() const
virtual void | prepareForAsyncUse()
virtual AssistReason | reason() const
virtual void | recreateTextDocument()
virtual QString | textAt(int position, int length) const
virtual QTextDocument * | textDocument() const

## Detailed Description

The AssistInterface class acts as an interface for providing access to the document from which a proposal is computed.

This interface existis in order to avoid a direct dependency on the text editor. This is particularly important and safer for asynchronous providers, since in such cases computation of the proposal is not done in the GUI thread.

In general this API tries to be as decoupled as possible from the base text editor. This is in order to make the design a bit more generic and allow code assist to be pluggable into different types of documents (there are still issues to be treated).

This class is part of the CodeAssist API.

See also IAssistProposal, IAssistProvider, and IAssistProcessor.

## Member Function Documentation

### AssistInterface::AssistInterface(QTextDocument *textDocument, int position, const QString &fileName, AssistReason reason)

Default constructs an instance of AssistInterface.

### `[virtual]` AssistInterface::~AssistInterface()

Destroys the instance of AssistInterface. The destructor is virtual.

### `[virtual]` QChar AssistInterface::characterAt(int position) const

Returns the character at position.

### `[virtual]` QString AssistInterface::fileName() const

Returns the file associated.

### `[virtual]` int AssistInterface::position() const

Returns the cursor position.

### `[virtual]` void AssistInterface::prepareForAsyncUse()

### `[virtual]` AssistReason AssistInterface::reason() const

The reason which triggered the assist.

### `[virtual]` void AssistInterface::recreateTextDocument()

### `[virtual]` QString AssistInterface::textAt(int position, int length) const

Returns the text at position with the given length.

### `[virtual]` QTextDocument *AssistInterface::textDocument() const

Returns the document.