KDEUI
#include <krichtextedit.h>
Public Types | |
enum | Mode { Plain, Rich } |
Signals | |
void | selectionFinished () |
void | textModeChanged (KRichTextEdit::Mode mode) |
Signals inherited from KTextEdit | |
void | aboutToShowContextMenu (QMenu *menu) |
void | checkSpellingChanged (bool) |
void | languageChanged (const QString &language) |
void | spellCheckerAutoCorrect (const QString ¤tWord, const QString &autoCorrectWord) |
void | spellCheckingCanceled () |
void | spellCheckingFinished () |
void | spellCheckStatus (const QString &) |
Protected Member Functions | |
virtual void | keyPressEvent (QKeyEvent *event) |
Protected Member Functions inherited from KTextEdit | |
bool | checkSpellingEnabledInternal () const |
virtual void | contextMenuEvent (QContextMenuEvent *) |
virtual void | deleteWordBack () |
virtual void | deleteWordForward () |
virtual bool | event (QEvent *) |
virtual void | focusInEvent (QFocusEvent *) |
virtual void | focusOutEvent (QFocusEvent *) |
virtual void | paintEvent (QPaintEvent *) |
void | setCheckSpellingEnabledInternal (bool check) |
virtual void | wheelEvent (QWheelEvent *) |
Additional Inherited Members | |
Protected Slots inherited from KTextEdit | |
void | slotDoFind () |
void | slotDoReplace () |
void | slotFind () |
void | slotFindNext () |
void | slotReplace () |
void | slotReplaceNext () |
void | slotSpeakText () |
Properties inherited from KTextEdit | |
bool | checkSpellingEnabled |
QString | clickMessage |
QString | spellCheckingLanguage |
Detailed Description
The KRichTextEdit class provides a widget to edit and display rich text.
It offers several additional rich text editing functions to KTextEdit and makes them easier to access including:
- Changing fonts, sizes.
- Font formatting, such as bold, underline, italic, foreground and background color.
- Paragraph alignment
- Ability to edit and remove hyperlinks
- Nested list handling
- Simple actions to insert tables. TODO
The KRichTextEdit can be in two modes: Rich text mode and plain text mode. Calling functions which modify the format/style of the text will automatically enable the rich text mode. Rich text mode is sometimes also referred to as HTML mode.
Do not call setAcceptRichText() or acceptRichText() yourself. Instead simply connect to the slots which insert the rich text, use switchToPlainText() or enableRichTextMode().
- Since
- 4.1
Definition at line 65 of file krichtextedit.h.
Member Enumeration Documentation
enum KRichTextEdit::Mode |
The mode the edit widget is in.
Enumerator | |
---|---|
Plain |
Plain text mode. |
Rich |
Rich text mode. |
Definition at line 74 of file krichtextedit.h.
Constructor & Destructor Documentation
Constructs a KRichTextEdit object.
Private class that helps to provide binary compatibility between releases.
- Parameters
-
text The initial text of the text edit, which is interpreted as HTML. parent The parent widget
Definition at line 118 of file krichtextedit.cpp.
|
explicit |
Constructs a KRichTextEdit object.
- Parameters
-
parent The parent widget
Definition at line 124 of file krichtextedit.cpp.
|
virtual |
Destructor.
Definition at line 130 of file krichtextedit.cpp.
Member Function Documentation
|
slot |
Sets the alignment of the current block to Centered.
Definition at line 182 of file krichtextedit.cpp.
|
slot |
Sets the alignment of the current block to Justified.
Definition at line 196 of file krichtextedit.cpp.
|
slot |
Sets the alignment of the current block to Left Aligned.
Definition at line 175 of file krichtextedit.cpp.
|
slot |
Sets the alignment of the current block to Right Aligned.
Definition at line 189 of file krichtextedit.cpp.
bool KRichTextEdit::canDedentList | ( | ) | const |
Returns true if the list item at the current position can be dedented.
- See also
- canIndentList
Definition at line 523 of file krichtextedit.cpp.
bool KRichTextEdit::canIndentList | ( | ) | const |
Returns true if the list item at the current position can be indented.
- See also
- canDedentList
Definition at line 518 of file krichtextedit.cpp.
QString KRichTextEdit::currentLinkText | ( | ) | const |
Returns the text of the link at the current position or an empty string if the cursor is not on a link.
- See also
- currentLinkUrl
- Returns
- The link text
Definition at line 371 of file krichtextedit.cpp.
QString KRichTextEdit::currentLinkUrl | ( | ) | const |
Returns the URL target (href) of the link at the current position or an empty string if the cursor is not on a link.
- See also
- currentLinkText
- Returns
- The link target URL
Definition at line 418 of file krichtextedit.cpp.
void KRichTextEdit::enableRichTextMode | ( | ) |
This enables rich text mode.
Nothing is done except changing the internal mode and allowing rich text pastes.
Definition at line 340 of file krichtextedit.cpp.
|
slot |
Decreases the nesting level of the current block or selected blocks.
- See also
- canDedentList
Definition at line 156 of file krichtextedit.cpp.
|
slot |
Increases the nesting level of the current block or selected blocks.
- See also
- canIndentList
Definition at line 150 of file krichtextedit.cpp.
|
slot |
Inserts a horizontal rule below the current block.
Definition at line 161 of file krichtextedit.cpp.
|
slot |
- Since
- 4.10 Because of binary compatibility constraints, insertPlainText is not virtual. Therefore it must dynamically detect and call this slot.
Definition at line 317 of file krichtextedit.cpp.
|
protectedvirtual |
Reimplemented.
Catches key press events. Used to handle some key presses on lists.
Reimplemented from KTextEdit.
Definition at line 485 of file krichtextedit.cpp.
|
slot |
Sets the direction of the current block to Left-To-Right.
- Since
- 4.6
Definition at line 214 of file krichtextedit.cpp.
|
slot |
Sets the direction of the current block to Right-To-Left.
- Since
- 4.6
Definition at line 203 of file krichtextedit.cpp.
|
signal |
Emitted whenever the user has finished making a selection.
(on mouse up)
void KRichTextEdit::selectLinkText | ( | QTextCursor * | cursor | ) | const |
If the cursor is on a link, sets the cursor to a selection of the text of the link.
If the cursor is not on a link, selects the current word or existing selection.
- Parameters
-
cursor The cursor to use to select the text.
- See also
- updateLink
Definition at line 385 of file krichtextedit.cpp.
void KRichTextEdit::selectLinkText | ( | ) | const |
Convenience function to select the link text using the active cursor.
- See also
- selectLinkText
Definition at line 378 of file krichtextedit.cpp.
|
slot |
Sets the current word or selection to the font font.
- Parameters
-
font the font of the text will be set to this font
Definition at line 297 of file krichtextedit.cpp.
|
slot |
Sets the current word or selection to the font family fontFamily.
- Parameters
-
fontFamily The text's font family will be changed to this one
Definition at line 279 of file krichtextedit.cpp.
|
slot |
Sets the current word or selection to the font size size.
- Parameters
-
size The text's font will get this size
Definition at line 288 of file krichtextedit.cpp.
|
slot |
Sets the list style of the current list, or creates a new list using the current block.
The _styleindex corresponds to the QTextListFormat::Style
- Parameters
-
_styleIndex The list will get this style
Definition at line 143 of file krichtextedit.cpp.
|
slot |
Sets the background color of the current word or selection to color.
- Parameters
-
color The text will get this foreground color
Definition at line 270 of file krichtextedit.cpp.
|
slot |
Toggles the bold formatting of the current word or selection at the current cursor position.
- Parameters
-
bold If true, the text will be set to bold
Definition at line 225 of file krichtextedit.cpp.
|
slot |
Sets the foreground color of the current word or selection to color.
- Parameters
-
color The text will get this background color
Definition at line 261 of file krichtextedit.cpp.
|
slot |
Toggles the italic formatting of the current word or selection at the current cursor position.
- Parameters
-
italic If true, the text will be set to italic
Definition at line 234 of file krichtextedit.cpp.
void KRichTextEdit::setTextOrHtml | ( | const QString & | text | ) |
Replaces all the content of the text edit with the given string.
If the string is in rich text format, the text is inserted as rich text, otherwise it is inserted as plain text.
- Parameters
-
text The text to insert
Definition at line 358 of file krichtextedit.cpp.
|
slot |
Toggles the strikeout formatting of the current word or selection at the current cursor position.
- Parameters
-
strikeOut If true, the text will be struck out
Definition at line 252 of file krichtextedit.cpp.
|
slot |
Toggles the subscript formatting of the current word or selection at the current cursor position.
- Parameters
-
subscript If true, the text will be set to subscript
Definition at line 331 of file krichtextedit.cpp.
|
slot |
Toggles the superscript formatting of the current word or selection at the current cursor position.
- Parameters
-
superscript If true, the text will be set to superscript
Definition at line 322 of file krichtextedit.cpp.
|
slot |
Toggles the underline formatting of the current word or selection at the current cursor position.
- Parameters
-
underline If true, the text will be underlined
Definition at line 243 of file krichtextedit.cpp.
|
slot |
This will switch the editor to plain text mode.
All rich text formatting will be destroyed.
Definition at line 306 of file krichtextedit.cpp.
KRichTextEdit::Mode KRichTextEdit::textMode | ( | ) | const |
- Returns
- The current text mode
Definition at line 345 of file krichtextedit.cpp.
|
signal |
Emitted whenever the text mode is changed.
- Parameters
-
mode The new text mode
QString KRichTextEdit::textOrHtml | ( | ) | const |
- Returns
- The plain text string if in plain text mode or the HTML code if in rich text mode. The text is not word-wrapped.
Definition at line 350 of file krichtextedit.cpp.
|
slot |
This will clean some of the bad html produced by the underlying QTextEdit It walks over all lines and cleans up a bit.
Should be improved to produce our own Html.
Definition at line 528 of file krichtextedit.cpp.
Replaces the current selection with a hyperlink with the link URL linkUrl and the link text linkText.
- Parameters
-
linkUrl The link will get this URL as href (target) linkText The link will get this alternative text, which is the text displayed in the text edit.
Definition at line 423 of file krichtextedit.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.