Provides command and name completion. More...
#include <IrcCompleter>
Inherits QObject.
Public Slots | |
void | complete (const QString &text, int cursor, Direction direction=Forward) |
void | reset () |
Signals | |
void | completed (const QString &text, int cursor) |
Public Member Functions | |
IrcCompleter (QObject *parent=nullptr) | |
~IrcCompleter () override | |
IrcBuffer * | buffer () const |
IrcCommandParser * | parser () const |
QString | suffix () const |
IrcCompleter provides command and name completion for a text input field. The completer is made context aware by assigning a command parser and a buffer that is currently active in the GUI. The parser is used for completing commands, and the buffer is used for completing buffer and user names.
In order to perform a completion, call complete() with the current text input field content and the cursor position. If a suitable completion is found, the completed() signal is emitted with a suggestion for a new content and cursor position for the text input field.
|
explicit |
Constructs a completer with parent.
|
override |
Destructs the completer.
IrcBuffer * IrcCompleter::buffer | ( | ) | const |
|
slot |
Completes text at cursor position, iterating multiple matches to the specified direction, and emits completed() if a suitable completion is found.
|
signal |
This signal is emitted when a suitable completion with text and cursor position is found.
IrcCommandParser * IrcCompleter::parser | ( | ) | const |
This property holds the parser used for command completion.
|
slot |
Resets the completer state.
QString IrcCompleter::suffix | ( | ) | const |
This property holds the completion suffix.
The suffix is appended to the end of a completed nick name, but only when the nick name is in the beginning of completed text.
The default value is ":"
.