KPIMTextEdit::RichTextComposer Class
class KPIMTextEdit::RichTextComposerThe RichTextComposer class. More...
| Header: | #include <KPIMTextEdit/RichTextComposer> |
| CMake: | find_package(KPim6TextEdit REQUIRED)target_link_libraries(mytarget PRIVATE KPim6::TextEdit) |
Public Types
| enum | Mode { Plain, Rich } |
Public Functions
| RichTextComposer(QWidget *parent = nullptr) | |
| virtual | ~RichTextComposer() override |
| void | activateRichText() |
| bool | checkExternalEditorFinished() |
| int | columnNumber() const |
| KPIMTextEdit::RichTextComposerActions * | composerActions() const |
| KPIMTextEdit::RichTextComposerControler * | composerControler() const |
| void | createActions(KActionCollection *ac) |
| const QString | defaultQuoteSign() const |
| void | disableWordWrap() |
| void | enableWordWrap(int wrapColumn) |
| KPIMTextEdit::RichTextExternalComposer * | externalComposer() const |
| void | forcePlainTextMarkup(bool force) |
| bool | isLineQuoted(const QString &line) const |
| void | killExternalEditor() |
| int | linePosition() const |
| virtual bool | processModifyText(QKeyEvent *event) |
| int | quoteLength(const QString &line, bool oneQuote = false) const |
| QString | quotePrefixName() const |
| QList<QAction *> | richTextActionList() const |
| void | setCursorPositionFromStart(unsigned int pos) |
| void | setEnableActions(bool state) |
| void | setExternalEditorPath(const QString &path) |
| virtual void | setHighlighterColors(KPIMTextEdit::RichTextComposerEmailQuoteHighlighter *highlighter) |
| void | setQuotePrefixName(const QString "ePrefix) |
| void | setTextOrHtml(const QString &text) |
| void | setUseExternalEditor(bool use) |
| virtual QString | smartQuote(const QString &msg) |
| void | switchToPlainText() |
| KPIMTextEdit::RichTextComposer::Mode | textMode() const |
| QString | textOrHtml() const |
Reimplemented Public Functions
| virtual void | createHighlighter() override |
Public Slots
| void | insertPlainTextImplementation() |
| void | slotChangeInsertMode() |
Signals
| void | externalEditorClosed() |
| void | externalEditorStarted() |
| void | focusUp() |
| void | insertEmoticon(const QString &str) |
| void | insertModeChanged() |
| void | textModeChanged(KPIMTextEdit::RichTextComposer::Mode mode) |
Protected Functions
| bool | processKeyEvent(QKeyEvent *e) |
Reimplemented Protected Functions
| virtual bool | canInsertFromMimeData(const QMimeData *source) const override |
| virtual void | clearDecorator() override |
| virtual Sonnet::SpellCheckDecorator * | createSpellCheckDecorator() override |
| virtual void | insertFromMimeData(const QMimeData *source) override |
| virtual void | keyPressEvent(QKeyEvent *event) override |
| virtual void | mouseReleaseEvent(QMouseEvent *event) override |
| virtual void | updateHighLighter() override |
Detailed Description
Author: Laurent Montel <montel@kde.org>
Member Type Documentation
enum RichTextComposer::Mode
The text mode of the composer.
| Constant | Value | Description |
|---|---|---|
KPIMTextEdit::RichTextComposer::Plain | 0 | Plain text mode |
KPIMTextEdit::RichTextComposer::Rich | 1 | Rich text mode |
Member Function Documentation
[explicit] RichTextComposer::RichTextComposer(QWidget *parent = nullptr)
Constructs a RichTextComposer with the given parent.
[override virtual noexcept] RichTextComposer::~RichTextComposer()
Destroys the RichTextComposer.
void RichTextComposer::activateRichText()
Activates rich text mode.
[override virtual protected] bool RichTextComposer::canInsertFromMimeData(const QMimeData *source) const
Returns true if the contents of the mime data source can be inserted.
bool RichTextComposer::checkExternalEditorFinished()
Checks if the external editor process has finished. Returns true if the editor has finished, false otherwise.
[override virtual protected] void RichTextComposer::clearDecorator()
Clears the spell check decorator. This implementation does nothing.
int RichTextComposer::columnNumber() const
Returns the column number where the cursor is.
KPIMTextEdit::RichTextComposerActions *RichTextComposer::composerActions() const
Returns the composer actions manager.
KPIMTextEdit::RichTextComposerControler *RichTextComposer::composerControler() const
Returns the composer controller.
void RichTextComposer::createActions(KActionCollection *ac)
Creates actions and adds them to the given ac action collection.
[override virtual] void RichTextComposer::createHighlighter()
Creates a new highlighter for email quotes.
[override virtual protected] Sonnet::SpellCheckDecorator *RichTextComposer::createSpellCheckDecorator()
Creates and returns the spell check decorator used for email quotes.
const QString RichTextComposer::defaultQuoteSign() const
Returns the default quote sign for this composer.
void RichTextComposer::disableWordWrap()
Disables word wrap. Note that words are still wrapped at the end of the editor; no scrollbar will appear.
void RichTextComposer::enableWordWrap(int wrapColumn)
Enables word wrap. Words will be wrapped at the specified column.
wrapColumn the column where words will be wrapped
KPIMTextEdit::RichTextExternalComposer *RichTextComposer::externalComposer() const
Returns the external composer for handling external editor operations.
[signal] void RichTextComposer::externalEditorClosed()
Emitted when the external editor is closed.
[signal] void RichTextComposer::externalEditorStarted()
Emitted when the external editor is started.
[signal] void RichTextComposer::focusUp()
Emitted when the user uses the up arrow in the first line. The application should then put the focus on the widget above the text edit.
void RichTextComposer::forcePlainTextMarkup(bool force)
Forces plain text markup style based on the force parameter.
[signal] void RichTextComposer::insertEmoticon(const QString &str)
Emitted when the emoticon str is inserted.
[override virtual protected] void RichTextComposer::insertFromMimeData(const QMimeData *source)
Inserts the contents of the mime data source, handling images and HTML depending on the text mode.
[signal] void RichTextComposer::insertModeChanged()
Emitted when the insert mode changes.
[slot] void RichTextComposer::insertPlainTextImplementation()
Inserts plain text from the clipboard.
bool RichTextComposer::isLineQuoted(const QString &line) const
Returns true if the given line is quoted.
[override virtual protected] void RichTextComposer::keyPressEvent(QKeyEvent *event)
Handles the key press event.
void RichTextComposer::killExternalEditor()
Terminates the external editor process.
int RichTextComposer::linePosition() const
Returns the line number where the cursor is. This takes word-wrapping into account. Line numbers start at 0.
[override virtual protected] void RichTextComposer::mouseReleaseEvent(QMouseEvent *event)
Handles the mouse release event. Disables the format painter if it is active.
[protected] bool RichTextComposer::processKeyEvent(QKeyEvent *e)
Processes the key event e. Starts the external editor if it is enabled. Returns true if the event was handled.
[virtual] bool RichTextComposer::processModifyText(QKeyEvent *event)
Processes the modify text key event. This is a virtual method that can be overridden by subclasses. Returns true if the event was processed, false otherwise.
int RichTextComposer::quoteLength(const QString &line, bool oneQuote = false) const
Calculates and returns the quote level of the given line. If oneQuote is true, only single quotes are counted.
QString RichTextComposer::quotePrefixName() const
Returns the current quote prefix name.
See also setQuotePrefixName().
QList<QAction *> RichTextComposer::richTextActionList() const
Returns the list of rich text actions.
void RichTextComposer::setCursorPositionFromStart(unsigned int pos)
Sets the cursor position to pos characters from the start of the document.
void RichTextComposer::setEnableActions(bool state)
Enables or disables actions based on the state parameter.
void RichTextComposer::setExternalEditorPath(const QString &path)
Sets the path to the external editor executable to path.
[virtual] void RichTextComposer::setHighlighterColors(KPIMTextEdit::RichTextComposerEmailQuoteHighlighter *highlighter)
Sets the highlighter colors using the given email quote highlighter. This is a virtual method that can be overridden by subclasses.
void RichTextComposer::setQuotePrefixName(const QString "ePrefix)
Sets the quote prefix name used for identifying quoted text to quotePrefix.
See also quotePrefixName().
void RichTextComposer::setTextOrHtml(const QString &text)
Sets the text content from the given text, interpreting it as either plain text or HTML.
See also textOrHtml().
void RichTextComposer::setUseExternalEditor(bool use)
Enables or disables the use of an external editor based on the use parameter.
[slot] void RichTextComposer::slotChangeInsertMode()
Changes the insert mode between insert and overwrite.
[virtual] QString RichTextComposer::smartQuote(const QString &msg)
Applies smart quoting to the given msg. This is a virtual method that can be overridden by subclasses.
void RichTextComposer::switchToPlainText()
Switches to plain text mode.
KPIMTextEdit::RichTextComposer::Mode RichTextComposer::textMode() const
Returns The current text mode
[signal] void RichTextComposer::textModeChanged(KPIMTextEdit::RichTextComposer::Mode mode)
Emitted whenever the text mode is changed.
mode The new text mode
QString RichTextComposer::textOrHtml() const
Returns the text content as either plain text or HTML based on the current mode.
See also setTextOrHtml().
[override virtual protected] void RichTextComposer::updateHighLighter()
Updates the highlighter according to the spell checking state.