IAssistProposalWidget Class
(TextEditor::IAssistProposalWidget)The IAssistProposalWidget class acts as an interface for widgets that display assist proposals. More...
Header: | #include <IAssistProposalWidget> |
Public Functions
IAssistProposalWidget() | |
virtual | ~IAssistProposalWidget() |
int | basePosition() const |
virtual void | closeProposal() = 0 |
virtual void | setAssistant(CodeAssistant *assistant) = 0 |
void | setBasePosition(int basePosition) |
virtual void | setDisplayRect(const QRect &rect) = 0 |
virtual void | setIsSynchronized(bool isSync) = 0 |
virtual void | setKind(AssistKind kind) = 0 |
virtual void | setModel(IAssistProposalModel *model) = 0 |
virtual void | setReason(AssistReason reason) = 0 |
virtual void | setUnderlyingWidget(const QWidget *underlyingWidget) = 0 |
virtual void | showProposal(const QString &prefix) = 0 |
virtual void | updateProposal(const QString &prefix) = 0 |
Signals
void | explicitlyAborted() |
void | prefixExpanded(const QString &newPrefix) |
void | proposalItemActivated(AssistProposalItemInterface *proposalItem) |
Detailed Description
The IAssistProposalWidget class acts as an interface for widgets that display assist proposals.
Known implenters of this interface are FunctionHintProposalWidget and GenericProposalWidget. The former is recommeded to be used when assisting function calls 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).
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 is class is part of the CodeAssist API.
See also IAssistProposal.
Member Function Documentation
IAssistProposalWidget::IAssistProposalWidget()
Default constructs an instance of IAssistProposalWidget.
[virtual]
IAssistProposalWidget::~IAssistProposalWidget()
Destroys the instance of IAssistProposalWidget. The destructor is virtual.
int IAssistProposalWidget::basePosition() const
See also setBasePosition().
[pure virtual]
void IAssistProposalWidget::closeProposal()
Closes the proposal.
[signal]
void IAssistProposalWidget::explicitlyAborted()
[signal]
void IAssistProposalWidget::prefixExpanded(const QString &newPrefix)
The signal is emitted whenever this widget automatically expands the prefix of the proposal. This can happen if all available proposal items share the same prefix and if the proposal's model supports prefix expansion.
See also GenericProposalModel::supportsPrefixExpansion().
[signal]
void IAssistProposalWidget::proposalItemActivated(AssistProposalItemInterface *proposalItem)
[pure virtual]
void IAssistProposalWidget::setAssistant(CodeAssistant *assistant)
Sets the code assistant which is the owner of this widget. This is used so that the code assistant can be notified when changes on the underlying widget happen.
void IAssistProposalWidget::setBasePosition(int basePosition)
See also basePosition().
[pure virtual]
void IAssistProposalWidget::setDisplayRect(const QRect &rect)
Sets the rect on which this widget should be displayed.
[pure virtual]
void IAssistProposalWidget::setIsSynchronized(bool isSync)
Sets whether this widget is synchronized. If a widget is synchronized it means that from the moment a proposal started being computed until the moment it is actually displayed, there was no content input into the underlying widget.
A widget is not synchronized in the case a proposal is computed in a separate thread and in the meanwhile (while it is still being processed) content is input into the underlying widget.
[pure virtual]
void IAssistProposalWidget::setKind(AssistKind kind)
[pure virtual]
void IAssistProposalWidget::setModel(IAssistProposalModel *model)
Sets the model.
[pure virtual]
void IAssistProposalWidget::setReason(AssistReason reason)
Sets the reason which triggered the assist.
[pure virtual]
void IAssistProposalWidget::setUnderlyingWidget(const QWidget *underlyingWidget)
Sets the underlying widget upon which this proposal operates.
[pure virtual]
void IAssistProposalWidget::showProposal(const QString &prefix)
Shows the proposal. The prefix is the string comprised from the character at the base position of the proposal until the character immediately after the cursor at the moment the proposal is displayed.
See also IAssistProposal::basePosition().
[pure virtual]
void IAssistProposalWidget::updateProposal(const QString &prefix)
Updates the proposal base on the give prefix.
See also showProposal().