KPIMTextEdit::RichTextComposerEmailQuoteHighlighter Class

class KPIMTextEdit::RichTextComposerEmailQuoteHighlighter

A highlighter for email quoting. More...

Header: #include <KPIMTextEdit/RichTextComposerEmailQuoteHighlighter>
CMake: find_package(KPim6TextEdit REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::TextEdit)

Public Functions

RichTextComposerEmailQuoteHighlighter(KPIMTextEdit::RichTextComposer *textEdit, const QColor &normalColor = Qt::black, const QColor &quoteDepth1 = QColor(0x00, 0x80, 0x00), const QColor &quoteDepth2 = QColor(0x00, 0x80, 0x00), const QColor &quoteDepth3 = QColor(0x00, 0x80, 0x00), const QColor &misspelledColor = Qt::red)
virtual ~RichTextComposerEmailQuoteHighlighter() override
void setQuoteColor(const QColor &normalColor, const QColor &quoteDepth1, const QColor &quoteDepth2, const QColor &quoteDepth3, const QColor &misspelledColor = Qt::red)
void toggleSpellHighlighting(bool on)

Reimplemented Public Functions

virtual void highlightBlock(const QString &text) override

Reimplemented Protected Functions

virtual void setMisspelled(int start, int count) override
virtual void unsetMisspelled(int start, int count) override

Detailed Description

Author: Laurent Montel <montel@kde.org>

Member Function Documentation

[explicit] RichTextComposerEmailQuoteHighlighter::RichTextComposerEmailQuoteHighlighter(KPIMTextEdit::RichTextComposer *textEdit, const QColor &normalColor = Qt::black, const QColor &quoteDepth1 = QColor(0x00, 0x80, 0x00), const QColor &quoteDepth2 = QColor(0x00, 0x80, 0x00), const QColor &quoteDepth3 = QColor(0x00, 0x80, 0x00), const QColor &misspelledColor = Qt::red)

Constructor with color customization. See setQuoteColor() for the parameters. Creates a highlighter with the given textEdit and optional custom colors: normalColor for normal text, quoteDepth1, quoteDepth2 and quoteDepth3 for the quote levels and misspelledColor for misspelled words. FIXME: Default colors don't obey color scheme

[override virtual noexcept] RichTextComposerEmailQuoteHighlighter::~RichTextComposerEmailQuoteHighlighter()

Destroys the RichTextComposerEmailQuoteHighlighter.

[override virtual] void RichTextComposerEmailQuoteHighlighter::highlightBlock(const QString &text)

Highlights the text block text with quote and spelling highlighting. Reimplemented from Sonnet::Highlighter to highlight quote blocks.

[override virtual protected] void RichTextComposerEmailQuoteHighlighter::setMisspelled(int start, int count)

Reimplemented to set the color of the misspelled word of count characters starting at start to a color defined by setQuoteColor().

void RichTextComposerEmailQuoteHighlighter::setQuoteColor(const QColor &normalColor, const QColor &quoteDepth1, const QColor &quoteDepth2, const QColor &quoteDepth3, const QColor &misspelledColor = Qt::red)

Sets the colors used for highlighting quoted text and spelling mistakes.

normalColor the color for normal text quoteDepth1 color for text quoted 1 level deep quoteDepth2 color for text quoted 2 level deep quoteDepth3 color for text quoted 3 level deep misspelledColor color in which misspelled words will be underlined

void RichTextComposerEmailQuoteHighlighter::toggleSpellHighlighting(bool on)

Turns spellcheck highlighting on or off based on the on parameter.

on if true, spelling mistakes will be highlighted

[override virtual protected] void RichTextComposerEmailQuoteHighlighter::unsetMisspelled(int start, int count)

Removes misspelled text formatting from the specified text range. Reimplemented, the base version sets the text color to black, which is not what we want. We do nothing, the format is already reset by Qt. start the beginning of text count the amount of characters to set