digiKam Developer Documentation: Digikam::DPlainTextEdit Class Reference

| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Signals | Public Member Functions | Protected Member Functions | List of all members
Digikam::DPlainTextEdit Class Reference

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

Inheritance diagram for Digikam::DPlainTextEdit:

## Signals
void | returnPressed ()
| Emitted only when mimic QLineEdit mode is enabled.
void | textEdited (const QString &)

## Public Member Functions
| DPlainTextEdit (const QString &contents, QWidget *const parent=nullptr)
| Constructor with text contents to use.
| DPlainTextEdit (QWidget *const parent=nullptr)
| Default constructor.
| DPlainTextEdit (unsigned int lines, QWidget *const parent=nullptr)
| Constructor with a number of lines.
| ~DPlainTextEdit () override
| Standard destructor.
QString | acceptedCharacters () const
| This property holds whether the edit widget handles the mask of accepted characters in text editor.
QString | currentLanguage () const
QString | ignoredCharacters () const
| This property holds whether the edit widget handles 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 handles 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 handles 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 handles the maximum of characters that user can enter in editor.
void | setText (const QString &text)
QSize | sizeHint () const override
| Reimplementation of sizeHint().
LocalizeContainer | spellCheckSettings () const
| This property holds whether the edit widget handles the Spellcheck settings.
QString | text () const
| This property holds whether the edit widget handle text contents as plain text.

## Protected Member Functions
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: dplaintextedit.cpp

## Constructor & Destructor Documentation

## ◆ DPlainTextEdit()

Digikam::DPlainTextEdit::DPlainTextEdit | ( | unsigned int | lines,
|  | QWidget *const | parent = `nullptr`
| ) |  |
| explicit

Zero lines do not apply a size constraint.

## Member Function Documentation

## ◆ acceptedCharacters()

QString Digikam::DPlainTextEdit::acceptedCharacters | ( |  | ) | const

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

## ◆ ignoredCharacters()

QString Digikam::DPlainTextEdit::ignoredCharacters | ( |  | ) | const

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

## ◆ isClearButtonEnabled()

bool Digikam::DPlainTextEdit::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::DPlainTextEdit::returnPressed | ( |  | ) |
| signal

See setLinesVisible() for details.

## ◆ setCurrentLanguage()

void Digikam::DPlainTextEdit::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 dependencies is not resolved, this method does nothing.

## ◆ setLinesVisible()

void Digikam::DPlainTextEdit::setLinesVisible | ( | unsigned int | lines | ) |

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

## ◆ setMaxLength()

void Digikam::DPlainTextEdit::setMaxLength | ( | int | length | ) |

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

## ◆ spellCheckSettings()

LocalizeContainer Digikam::DPlainTextEdit::spellCheckSettings | ( |  | ) | const

See LocalizeContainer class for details.

## ◆ text()

QString Digikam::DPlainTextEdit::text | ( |  | ) | const

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