Extending Qt Creator Manual | IAssistProposal

Extending Qt Creator Manual 4.4.1

# IAssistProposal Class

(TextEditor::IAssistProposal)

The IAssistProposal class acts as an interface for representing an assist proposal. More...

Header: | #include <IAssistProposal>

- List of all members, including inherited members

## Public Functions

| IAssistProposal(int basePosition)
virtual | ~IAssistProposal()
int | basePosition() const
virtual IAssistProposalWidget * | createWidget() const = 0
virtual bool | hasItemsToPropose(const QString &, AssistReason) const
virtual bool | isCorrective(TextEditorWidget *editorWidget) const
virtual bool | isFragile() const = 0
virtual void | makeCorrection(TextEditorWidget *editorWidget)
virtual IAssistProposalModel * | model() const = 0

## Detailed Description

The IAssistProposal class acts as an interface for representing an assist proposal.

Known implenters of this interface are FunctionHintProposal and GenericProposal. The former is recommended to be used when assisting function call constructs (overloads and parameters) while the latter is quite generic so that it could be used to propose snippets, refactoring operations (quickfixes), and contextual content (the member of class or a string existent in the document, for example).

This class is part of the CodeAssist API.

See also IAssistProposalWidget and IAssistModel.

## Member Function Documentation

### IAssistProposal::IAssistProposal(int basePosition)

Default constructs an instance of IAssistProposal.

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

Destroys the instance of IAssistProposal. The destructor is virtual.

### int IAssistProposal::basePosition() const

Returns the position from which this proposal starts.

### `[pure virtual]` IAssistProposalWidget *IAssistProposal::createWidget() const

Returns the widget associated with this proposal. The IAssistProposalWidget implementor recommended for function hint proposals is FunctionHintProposalWidget. For snippets, refactoring operations (quickfixes), and contextual content the recommeded implementor is GenericProposalWidget.

### `[virtual]` bool IAssistProposal::hasItemsToPropose(const QString &, AssistReason) const

### `[virtual]` bool IAssistProposal::isCorrective(TextEditorWidget *editorWidget) const

### `[pure virtual]` bool IAssistProposal::isFragile() const

Returns whether this is a fragile proposal. When a proposal is fragile it means that it will be replaced by a new proposal in the case one is created, even if due to an idle editor.

### `[virtual]` void IAssistProposal::makeCorrection(TextEditorWidget *editorWidget)

### `[pure virtual]` IAssistProposalModel *IAssistProposal::model() const

Returns the model associated with this proposal.

Although the IAssistModel from this proposal may be used on its own, it needs to be consistent with the widget returned by createWidget().

See also createWidget().