Crossfire Server, Trunk
AssetTextEdit Class Reference

#include <AssetTextEdit.h>

+ Inheritance diagram for AssetTextEdit:
+ Collaboration diagram for AssetTextEdit:

Public Member Functions

 AssetTextEdit (QWidget *parent)
 

Protected Member Functions

virtual void keyPressEvent (QKeyEvent *e) override
 

Private Slots

void insertCompletion (const QString &completion)
 

Private Member Functions

QString textUnderCursor () const
 

Private Attributes

AssetFieldCompletermyCompleter
 

Detailed Description

Multiline edit with auto-completion for asset fields. This class relies on AssetFieldCompleter for completion. The code is heavily borrowed from https://doc.qt.io/qt-6/qtwidgets-tools-customcompleter-example.html

Definition at line 25 of file AssetTextEdit.h.

Constructor & Destructor Documentation

◆ AssetTextEdit()

AssetTextEdit::AssetTextEdit ( QWidget *  parent)

Constructor.

Parameters
parentparent widget.

Definition at line 17 of file AssetTextEdit.cpp.

References insertCompletion(), and myCompleter.

+ Here is the call graph for this function:

Member Function Documentation

◆ insertCompletion

void AssetTextEdit::insertCompletion ( const QString &  completion)
privateslot

Insert the completed text at the cursor's position, replacing part of the contents if needed.

Parameters
completiontext to insert.

Definition at line 54 of file AssetTextEdit.cpp.

References myCompleter.

Referenced by AssetTextEdit().

+ Here is the caller graph for this function:

◆ keyPressEvent()

void AssetTextEdit::keyPressEvent ( QKeyEvent *  e)
overrideprotectedvirtual

Definition at line 26 of file AssetTextEdit.cpp.

References myCompleter, and textUnderCursor().

+ Here is the call graph for this function:

◆ textUnderCursor()

QString AssetTextEdit::textUnderCursor ( ) const
private

Get the complete text under the cursor, including all letters and dots before, all letters after.

Returns
test.

Definition at line 63 of file AssetTextEdit.cpp.

References c, and say::item.

Referenced by keyPressEvent().

+ Here is the caller graph for this function:

Field Documentation

◆ myCompleter

AssetFieldCompleter* AssetTextEdit::myCompleter
private

Completer used to suggest words.

Definition at line 39 of file AssetTextEdit.h.

Referenced by AssetTextEdit(), insertCompletion(), and keyPressEvent().


The documentation for this class was generated from the following files: