Communi  3.7.0
A cross-platform IRC framework written with Qt
Loading...
Searching...
No Matches
IrcCompleter Class Reference

Provides command and name completion. More...

#include <IrcCompleter>

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
 
IrcBufferbuffer () const
 
IrcCommandParserparser () const
 
QString suffix () const
 

Detailed Description

Since
3.1

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.

TextField {
id: textField
Keys.onTabPressed: completer.complete(text, cursorPosition)
id: completer
buffer: ...
parser: ...
onCompleted: {
textField.text = text
textField.cursorPosition = cursor
}
}
}
Provides command and name completion.
Definition irccompleter.h:44
See also
IrcCommandParser, IrcBuffer

Constructor & Destructor Documentation

◆ IrcCompleter()

IrcCompleter::IrcCompleter ( QObject * parent = nullptr)
explicit

Constructs a completer with parent.

◆ ~IrcCompleter()

IrcCompleter::~IrcCompleter ( )
override

Destructs the completer.

Member Function Documentation

◆ buffer()

IrcBuffer * IrcCompleter::buffer ( ) const

This property holds the buffer used for name completion.

Access functions:
Notifier signal:

◆ complete

void IrcCompleter::complete ( const QString & text,
int cursor,
Direction direction = Forward )
slot

Completes text at cursor position, iterating multiple matches to the specified direction, and emits completed() if a suitable completion is found.

◆ completed

void IrcCompleter::completed ( const QString & text,
int cursor )
signal

This signal is emitted when a suitable completion with text and cursor position is found.

◆ parser()

IrcCommandParser * IrcCompleter::parser ( ) const

This property holds the parser used for command completion.

Access functions:
Notifier signal:

◆ reset

void IrcCompleter::reset ( )
slot

Resets the completer state.

◆ suffix()

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 ":".

Access functions:
  • QString suffix() const
  • void setSuffix(const QString& suffix) [slot]
Notifier signal:
  • void suffixChanged(const QString& suffix)