digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::DTextEdit Class Reference

A text edit widget based on QTextEdit with spell checker capabilities based on Sonnet (optional). More...

+ Inheritance diagram for Digikam::DTextEdit:

Signals

void editingFinished ()
 
void returnPressed ()
 Emmited only when mimic QLineEdit mode is enabled.
 
void textEdited (const QString &)
 

Public Member Functions

 DTextEdit (const QString &contents, QWidget *const parent=nullptr)
 Constructor with text contents to use.
 
 DTextEdit (QWidget *const parent=nullptr)
 Default constructor.
 
 DTextEdit (unsigned int lines, QWidget *const parent=nullptr)
 Constructor with a number of lines.
 
 ~DTextEdit () override
 Standard destructor.
 
QString acceptedCharacters () const
 This property holds whether the edit widget handle the mask of accepted characters in text editor.
 
QString currentLanguage () const
 
QString ignoredCharacters () const
 This property holds whether the edit widget handle the mask of ignored characters in text editor.
 
bool isClearButtonEnabled () const
 This property holds whether the edit widget displays a clear button when it is not empty.
 
int leftCharacters () const
 Return the left characters that user can enter if a limit have been previously set with setMaxLeght().
 
unsigned int linesVisible () const
 
int maxLength () const
 
void setAcceptedCharacters (const QString &mask)
 
void setClearButtonEnabled (bool enable)
 
void setCurrentLanguage (const QString &lang)
 This property holds whether the edit widget handle a specific spell-checker language (2 letters code based as "en", "fr", "es", etc.).
 
void setIgnoredCharacters (const QString &mask)
 
void setLinesVisible (unsigned int lines)
 This property holds whether the edit widget handle visible lines used by the widget to show text.
 
void setLocalizeSettings (const LocalizeContainer &settings)
 
void setMaxLength (int length)
 This property holds whether the edit widget handle the maximum of characters that user can enter in editor.
 
void setText (const QString &text)
 
LocalizeContainer spellCheckSettings () const
 This property holds whether the edit widget handle the Spellcheck settings.
 
QString text () const
 This property holds whether the edit widget handle text contents as plain text.
 

Protected Member Functions

void focusOutEvent (QFocusEvent *e) override
 
void insertFromMimeData (const QMimeData *source) override
 
void keyPressEvent (QKeyEvent *e) override
 

Detailed Description

Widget size can be constrained with the number of visible lines. A single line constraint will emulate QLineEdit. See setLinesVisible() for details. The maximum number of characters can be limited with setMaxLenght(). The characters can be limited in editor by setIgnoredCharacters() and setAcceptedCharacters(). Implementation: dtextedit.cpp

Constructor & Destructor Documentation

◆ DTextEdit()

Digikam::DTextEdit::DTextEdit ( unsigned int  lines,
QWidget *const  parent = nullptr 
)
explicit

Zero lines do not apply a size constraint.

Member Function Documentation

◆ acceptedCharacters()

QString Digikam::DTextEdit::acceptedCharacters ( ) const

The mask of characters is passed as string (ex: "abcABC"). By default the mask is empty.

◆ ignoredCharacters()

QString Digikam::DTextEdit::ignoredCharacters ( ) const

The mask of characters is passed as string (ex: "+/!()"). By default the mask is empty.

◆ isClearButtonEnabled()

bool Digikam::DTextEdit::isClearButtonEnabled ( ) const

If enabled, the edit widget displays a trailing clear button when it contains some text, otherwise the edit widget does not show a clear button. This option only take effect in QLineEdit emulation mode when lines visible is set to 1. See setLinesVisible() for details.

◆ returnPressed

void Digikam::DTextEdit::returnPressed ( )
signal

See setLinesVisible() for details.

◆ setCurrentLanguage()

void Digikam::DTextEdit::setCurrentLanguage ( const QString &  lang)

If this property is not set, spell-checker will try to auto-detect language by parsing the text. To reset this setting, pass a empty string as language. If Sonnet depedencies is not resolved, these method do nothing.

◆ setLinesVisible()

void Digikam::DTextEdit::setLinesVisible ( unsigned int  lines)

Lines must be superior or egal to 1 to apply a size constraint. Notes: if a single visible line is used, the widget will emulate QLineEdit. a null value do not apply a size constraint.

◆ setMaxLength()

void Digikam::DTextEdit::setMaxLength ( int  length)

By default no limit is set. A zero length reset a limit.

◆ spellCheckSettings()

LocalizeContainer Digikam::DTextEdit::spellCheckSettings ( ) const

See LocalizeContainer class for details.

◆ text()

QString Digikam::DTextEdit::text ( ) const

If ignored or accepted characters masks are set, text is filtered accordingly.