KPIMTextEdit::RichTextComposerControler Class

class KPIMTextEdit::RichTextComposerControler

The RichTextComposerControler class provides control and logic for rich text composition operations. More...

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

Public Functions

RichTextComposerControler(KPIMTextEdit::RichTextComposer *richtextComposer, QObject *parent = nullptr)
virtual ~RichTextComposerControler() override
void addQuotes(const QString &defaultQuote)
bool canDedentList() const
bool canIndentList() const
KPIMTextEdit::RichTextComposerImages *composerImages() const
QString currentLinkText() const
QString currentLinkUrl() const
void disablePainter()
void ensureCursorVisible()
void insertLink(const QString &url)
bool isFormattingUsed() const
KPIMTextEdit::NestedListHelper *nestedListHelper() const
bool painterActive() const
KPIMTextEdit::RichTextComposer *richTextComposer() const
void selectLinkText() const
void setCursorPositionFromStart(unsigned int pos)
void setFontForWholeText(const QFont &font)
void textModeChanged(KPIMTextEdit::RichTextComposer::Mode mode)
QString toCleanHtml() const
QString toCleanPlainText(const QString &plainText = QString()) const
QString toWrappedPlainText() const
QString toWrappedPlainText(QTextDocument *doc) const
void updateLink(const QString &linkUrl, const QString &linkText)

Public Slots

void addCheckbox(bool add = true)
void alignCenter()
void alignJustify()
void alignLeft()
void alignRight()
void ensureCursorVisibleDelayed()
void indentListLess()
void indentListMore()
void insertHorizontalRule()
void makeLeftToRight()
void makeRightToLeft()
void manageLink()
void setChangeTextBackgroundColor()
void setChangeTextForegroundColor()
void setFont(const QFont &font)
void setFontFamily(const QString &fontFamily)
void setFontSize(int size)
void setHeadingLevel(int level)
void setListStyle(int styleIndex)
void setTextBackgroundColor(const QColor &color)
void setTextBold(bool bold)
void setTextForegroundColor(const QColor &color)
void setTextItalic(bool italic)
void setTextStrikeOut(bool strikeOut)
void setTextSubScript(bool subscript)
void setTextSuperScript(bool superscript)
void setTextUnderline(bool underline)
void slotAddEmoticon(const QString &text)
void slotAddImage()
void slotAddQuotes()
void slotFormatPainter(bool active)
void slotFormatReset()
void slotInsertHtml()
void slotPasteAsQuotation()
void slotPasteWithoutFormatting()
void slotRemoveQuotes()

Detailed Description

Author: Laurent Montel <montel@kde.org>

Member Function Documentation

[explicit] RichTextComposerControler::RichTextComposerControler(KPIMTextEdit::RichTextComposer *richtextComposer, QObject *parent = nullptr)

Constructs a RichTextComposerControler with the given richtextComposer and parent.

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

Destroys the RichTextComposerControler.

[slot] void RichTextComposerControler::addCheckbox(bool add = true)

Adds or removes a checkbox from the current line based on the add parameter.

void RichTextComposerControler::addQuotes(const QString &defaultQuote)

Adds quotes to the given defaultQuote.

[slot] void RichTextComposerControler::alignCenter()

Centers the current text or selection.

[slot] void RichTextComposerControler::alignJustify()

Justifies the current text or selection.

[slot] void RichTextComposerControler::alignLeft()

Aligns the current text or selection to the left.

[slot] void RichTextComposerControler::alignRight()

Aligns the current text or selection to the right.

bool RichTextComposerControler::canDedentList() const

Returns true if the current list can be dedented.

bool RichTextComposerControler::canIndentList() const

Returns true if the current list can be indented further.

KPIMTextEdit::RichTextComposerImages *RichTextComposerControler::composerImages() const

Returns the composer images helper.

QString RichTextComposerControler::currentLinkText() const

Returns the text of the current link at the cursor position.

QString RichTextComposerControler::currentLinkUrl() const

Returns the URL of the current link at the cursor position.

void RichTextComposerControler::disablePainter()

Disables the painter.

void RichTextComposerControler::ensureCursorVisible()

Ensures the cursor is visible by scrolling if necessary.

[slot] void RichTextComposerControler::ensureCursorVisibleDelayed()

Ensures the cursor is visible with a delay.

[slot] void RichTextComposerControler::indentListLess()

Decreases the indentation of the current list.

[slot] void RichTextComposerControler::indentListMore()

Increases the indentation of the current list.

[slot] void RichTextComposerControler::insertHorizontalRule()

Inserts a horizontal rule at the cursor position.

Inserts a link with the given url at the cursor position.

bool RichTextComposerControler::isFormattingUsed() const

Returns true if formatting has been used in the text.

[slot] void RichTextComposerControler::makeLeftToRight()

Sets the text direction to left-to-right.

[slot] void RichTextComposerControler::makeRightToLeft()

Sets the text direction to right-to-left.

Opens a dialog to manage links.

KPIMTextEdit::NestedListHelper *RichTextComposerControler::nestedListHelper() const

Returns the helper for managing nested lists.

bool RichTextComposerControler::painterActive() const

Returns true if the painter is currently active.

KPIMTextEdit::RichTextComposer *RichTextComposerControler::richTextComposer() const

Returns the RichTextComposer managed by this controller.

void RichTextComposerControler::selectLinkText() const

Selects the text of the current link.

[slot] void RichTextComposerControler::setChangeTextBackgroundColor()

Opens a dialog to change the text background color.

[slot] void RichTextComposerControler::setChangeTextForegroundColor()

Opens a dialog to change the text foreground color.

void RichTextComposerControler::setCursorPositionFromStart(unsigned int pos)

Sets the cursor position to pos characters from the start of the document.

[slot] void RichTextComposerControler::setFont(const QFont &font)

Sets the font to the given font.

[slot] void RichTextComposerControler::setFontFamily(const QString &fontFamily)

Sets the font family to the given fontFamily.

void RichTextComposerControler::setFontForWholeText(const QFont &font)

Sets the font for the entire text content to font.

[slot] void RichTextComposerControler::setFontSize(int size)

Sets the font size to the given size.

[slot] void RichTextComposerControler::setHeadingLevel(int level)

Sets the heading level to the given level.

[slot] void RichTextComposerControler::setListStyle(int styleIndex)

Sets the list style based on the given styleIndex.

[slot] void RichTextComposerControler::setTextBackgroundColor(const QColor &color)

Sets the text background color to the given color.

[slot] void RichTextComposerControler::setTextBold(bool bold)

Sets or removes bold formatting based on the bold parameter.

[slot] void RichTextComposerControler::setTextForegroundColor(const QColor &color)

Sets the text foreground color to the given color.

[slot] void RichTextComposerControler::setTextItalic(bool italic)

Sets or removes italic formatting based on the italic parameter.

[slot] void RichTextComposerControler::setTextStrikeOut(bool strikeOut)

Sets or removes strikethrough formatting based on the strikeOut parameter.

[slot] void RichTextComposerControler::setTextSubScript(bool subscript)

Sets or removes subscript formatting based on the subscript parameter.

[slot] void RichTextComposerControler::setTextSuperScript(bool superscript)

Sets or removes superscript formatting based on the superscript parameter.

[slot] void RichTextComposerControler::setTextUnderline(bool underline)

Sets or removes underline formatting based on the underline parameter.

[slot] void RichTextComposerControler::slotAddEmoticon(const QString &text)

Inserts an emoticon from the given text.

[slot] void RichTextComposerControler::slotAddImage()

Opens a dialog to add an image.

[slot] void RichTextComposerControler::slotAddQuotes()

Adds quotation formatting to the current text.

[slot] void RichTextComposerControler::slotFormatPainter(bool active)

Activates or deactivates the format painter based on the active parameter.

[slot] void RichTextComposerControler::slotFormatReset()

Resets all formatting in the current selection.

[slot] void RichTextComposerControler::slotInsertHtml()

Opens a dialog to insert HTML.

[slot] void RichTextComposerControler::slotPasteAsQuotation()

Pastes content as a quotation.

[slot] void RichTextComposerControler::slotPasteWithoutFormatting()

Pastes content without formatting.

[slot] void RichTextComposerControler::slotRemoveQuotes()

Removes quotation formatting from the current text.

void RichTextComposerControler::textModeChanged(KPIMTextEdit::RichTextComposer::Mode mode)

This signal is emitted when the text mode changes to mode.

QString RichTextComposerControler::toCleanHtml() const

Returns the HTML content as a clean string.

QString RichTextComposerControler::toCleanPlainText(const QString &plainText = QString()) const

Returns clean plain text, optionally from the given plainText.

QString RichTextComposerControler::toWrappedPlainText() const

Returns the wrapped plain text of the current document.

QString RichTextComposerControler::toWrappedPlainText(QTextDocument *doc) const

Returns the plain text wrapped according to the document's settings.

Updates the link at the cursor position with the given linkUrl and linkText.