# class KRichTextWidget

###

Module | kdeui
Namespace |
Class | KRichTextWidget
Inherits | KRichTextEdit

A KRichTextEdit with common actions

This class implements common actions which are often used with KRichTextEdit. All you need to do is to call createActions(), and the actions will be added to your KXMLGUIWindow. Remember to also add the chosen actions to your application ui.rc file.

See the KRichTextWidget.RichTextSupportValues enum for an overview of supported actions.

Author Stephen Kelly <steveire@gmail.com> Author Thomas McGuire <thomas.mcguire@gmx.net>

@since 4.1

### enums

- RichTextSupportValues { DisableRichText, SupportBold, SupportItalic, SupportUnderline, SupportStrikeOut, SupportFontFamily, SupportFontSize, SupportTextForegroundColor, SupportTextBackgroundColor, FullTextFormattingSupport, SupportChangeListStyle, SupportIndentLists, SupportDedentLists, FullListSupport, SupportAlignment, SupportRuleLine, SupportHyperlinks, SupportFormatPainting, SupportToPlainText, FullSupport }
  typesafe object: RichTextSupport

enum details

### methods

- KRichTextWidget (parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  parent | QWidget |

  Constructor

  parent - the parent widget

- KRichTextWidget (text, parent)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  text | QString |
  parent | QWidget | 0

  Constructs a KRichTextWidget object

  text - The initial text of the text edit, which is interpreted as HTML.

  parent - The parent widget

- createActions (actionCollection)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  actionCollection | KActionCollection |

  Creates the actions and adds them to the given action collection.

  Call this before calling setupGUI() in your application, but after calling setRichTextSupport().

  The XML file of your KXmlGuiWindow needs to have the action names in them, so that the actions actually appear in the menu and in the toolbars.

  Below is a list of actions that are created,depending on the supported rich text subset set by setRichTextSupport(). The list contains action names. Those names need to be the same in your XML file.

  See the KRichTextWidget.RichTextSupportValues enum documentation for a detailed explaination of each action.

  XML Name | RichTextSupportValues flag
  format_text_foreground_color | SupportTextForegroundColor
  format_text_background_color | SupportTextBackgroundColor
  format_font_family | SupportFontFamily
  format_font_size | SupportFontSize
  format_text_bold | SupportBold
  format_text_italic | SupportItalic
  format_text_underline | SupportUnderline
  format_text_strikeout | SupportStrikeOut
  format_align_left | SupportAlignment
  format_align_center | SupportAlignment
  format_align_right | SupportAlignment
  format_align_justify | SupportAlignment
  format_list_style | SupportChangeListStyle
  format_list_indent_more | SupportIndentLists
  format_list_indent_less | SupportDedentLists
  insert_horizontal_rule | SupportRuleLine
  manage_link | SupportHyperlinks
  format_painter | SupportFormatPainting
  action_to_plain_text | SupportToPlainText

  actionCollection - the actions will be added to this action collection

- mouseReleaseEvent (event)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  event | QMouseEvent |

  Reimplemented. Catches mouse release events. Used to know when a selection has been completed.

- richTextSupport ( )

  returns KRichTextWidget.RichTextSupport

  Returns the supported rich text subset available. Returns The supported subset.

- setActionsEnabled (enabled)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enabled | bool |

  Disables or enables all of the actions created by createActions(). This may be useful in cases where rich text mode may be set on or off.

  enabled - Whether to enable or disable the actions.

- setRichTextSupport (support)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  support | KRichTextWidget.RichTextSupport |

  Sets the supported rich text subset available.

  The default is KRichTextWidget.FullSupport and will be set in the constructor.

  You need to call createActions() afterwards.

  support - The supported subset.

- updateActionStates ( )

  returns Nothing

  Tells KRichTextWidget to update the state of the actions created by createActions(). This is normally automatically done, but there might be a few cases where you'll need to manually call this function.

  Call this function only after calling createActions().

### enums - detail

- RichTextSupportValues { DisableRichText, SupportBold, SupportItalic, SupportUnderline, SupportStrikeOut, SupportFontFamily, SupportFontSize, SupportTextForegroundColor, SupportTextBackgroundColor, FullTextFormattingSupport, SupportChangeListStyle, SupportIndentLists, SupportDedentLists, FullListSupport, SupportAlignment, SupportRuleLine, SupportHyperlinks, SupportFormatPainting, SupportToPlainText, FullSupport }

  No rich text support at all, no actions will be created. Do not use in combination with other flags.

  typesafe object: RichTextSupport

DisableRichText - 0x00 -
SupportBold - 0x01 -
SupportItalic - 0x02 -
SupportUnderline - 0x04 -
SupportStrikeOut - 0x08 -
SupportFontFamily - 0x10 -
SupportFontSize - 0x20 -
SupportTextForegroundColor - 0x40 -
SupportTextBackgroundColor - 0x80 -
FullTextFormattingSupport - 0xff -
SupportChangeListStyle - 0x100 -
SupportIndentLists - 0x200 -
SupportDedentLists - 0x400 -
FullListSupport - 0xf00 -
SupportAlignment - 0x100000 -
SupportRuleLine - 0x400000 -
SupportHyperlinks - 0x800000 -
SupportFormatPainting - 0x1000000 -
SupportToPlainText - 0x2000000 -
FullSupport - 0xffffffff -