Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
pqTextEdit Class Reference

pqTextEdit is a specialization of QTextEdit which provide editingFinished() and textChangedAndEditingFinished() signals, as well as the possibility to be autocompleted. More...

#include <pqTextEdit.h>

Inheritance diagram for pqTextEdit:
Inheritance graph
[legend]

Signals

void textChangedAndEditingFinished ()
 Unlike editingFinished() which gets fired whenever the widget looses focus irrespective of if the text actually was edited, textChangedAndEditingFinished() is fired only when the text was changed as well. More...
 
void editingFinished ()
 Just like the QLineEdit::editingFinished(), this signal is fired every time the widget loses focus. More...
 

Public Member Functions

 pqTextEdit (QWidget *parent=nullptr)
 
 pqTextEdit (const QString &contents, QWidget *parent=nullptr)
 
void setCompleter (pqWidgetCompleter *completer)
 
pqWidgetCompletergetCompleter ()
 
 ~pqTextEdit () override
 

Protected Member Functions

void keyPressEvent (QKeyEvent *e) override
 
void focusOutEvent (QFocusEvent *e) override
 
void focusInEvent (QFocusEvent *e) override
 
QString textUnderCursor () const
 Returns the text of the current line in the input field. More...
 
void updateCompleter ()
 Trigger an update on the completer if any, and show the popup if completions are available. More...
 
void updateCompleterIfVisible ()
 In case the completer popup menu is already shown, update it to reflect modifications on the input text. More...
 
void selectCompletion ()
 Insert the completion in case there is only one available. More...
 

Protected Attributes

QScopedPointer< pqTextEditPrivate > d_ptr
 

Detailed Description

pqTextEdit is a specialization of QTextEdit which provide editingFinished() and textChangedAndEditingFinished() signals, as well as the possibility to be autocompleted.

An autocompleter object can be set using setCompleter(). For this, autocompleter must implement the updateCompletionModel() method through the interface defined by pqWidgetCompleter, providing completion for a given string.

Unlike editingFinished() which gets fired whenever the widget looses focus irrespective of if the text if actually was edited, textChangedAndEditingFinished() is fired only when the text was changed as well.

Important Notes: The editingFinished() signals and the textChangedAndEditingFinished() are NOT sent when using the setText, setPlainText and setHtml methods.

Also the textChangedAndEditingFinished() is not truly emitted only when the text has changed and the edition is finished. For example, removing a letter and adding it back will cause the signal to be fired even though the text is the same as before.

Definition at line 37 of file pqTextEdit.h.

Constructor & Destructor Documentation

◆ pqTextEdit() [1/2]

pqTextEdit::pqTextEdit ( QWidget *  parent = nullptr)

◆ pqTextEdit() [2/2]

pqTextEdit::pqTextEdit ( const QString &  contents,
QWidget *  parent = nullptr 
)

◆ ~pqTextEdit()

pqTextEdit::~pqTextEdit ( )
override

Member Function Documentation

◆ setCompleter()

void pqTextEdit::setCompleter ( pqWidgetCompleter completer)

◆ getCompleter()

pqWidgetCompleter* pqTextEdit::getCompleter ( )
inline

Definition at line 47 of file pqTextEdit.h.

◆ textChangedAndEditingFinished

void pqTextEdit::textChangedAndEditingFinished ( )
signal

Unlike editingFinished() which gets fired whenever the widget looses focus irrespective of if the text actually was edited, textChangedAndEditingFinished() is fired only when the text was changed as well.

◆ editingFinished

void pqTextEdit::editingFinished ( )
signal

Just like the QLineEdit::editingFinished(), this signal is fired every time the widget loses focus.

◆ keyPressEvent()

void pqTextEdit::keyPressEvent ( QKeyEvent *  e)
overrideprotected

◆ focusOutEvent()

void pqTextEdit::focusOutEvent ( QFocusEvent *  e)
overrideprotected

◆ focusInEvent()

void pqTextEdit::focusInEvent ( QFocusEvent *  e)
overrideprotected

◆ textUnderCursor()

QString pqTextEdit::textUnderCursor ( ) const
protected

Returns the text of the current line in the input field.

◆ updateCompleter()

void pqTextEdit::updateCompleter ( )
protected

Trigger an update on the completer if any, and show the popup if completions are available.

◆ updateCompleterIfVisible()

void pqTextEdit::updateCompleterIfVisible ( )
protected

In case the completer popup menu is already shown, update it to reflect modifications on the input text.

◆ selectCompletion()

void pqTextEdit::selectCompletion ( )
protected

Insert the completion in case there is only one available.

Member Data Documentation

◆ d_ptr

QScopedPointer<pqTextEditPrivate> pqTextEdit::d_ptr
protected

Definition at line 97 of file pqTextEdit.h.


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