• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

KRichTextWidget Class Reference

A KRichTextEdit with common actions. More...

#include <krichtextwidget.h>

Inheritance diagram for KRichTextWidget:
KRichTextEdit KTextEdit QTextEdit

List of all members.

Public Types

enum  RichTextSupportValues {
  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, SupportSuperScriptAndSubScript = 0x4000000,
  FullSupport = 0xffffffff
}

Public Slots

void setActionsEnabled (bool enabled)

Public Member Functions

virtual void createActions (KActionCollection *actionCollection)
 KRichTextWidget (const QString &text, QWidget *parent=0)
 KRichTextWidget (QWidget *parent)
RichTextSupport richTextSupport () const
void setRichTextSupport (const KRichTextWidget::RichTextSupport &support)
void updateActionStates ()
 ~KRichTextWidget ()

Protected Member Functions

virtual void mouseReleaseEvent (QMouseEvent *event)

Detailed Description

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>
Thomas McGuire <thomas.mcguire@gmx.net>
Since:
4.1

Definition at line 43 of file krichtextwidget.h.


Member Enumeration Documentation

enum KRichTextWidget::RichTextSupportValues

These flags describe what actions will be created by createActions() after passing a combination of these flags to setRichTextSupport().

Enumerator:
DisableRichText 

No rich text support at all, no actions will be created.

Do not use in combination with other flags.

SupportBold 

Action to format the selected text as bold.

If no text is selected, the word under the cursor is formatted bold. This is a KToggleAction. The status is automatically updated when the text cursor is moved.

SupportItalic 

Action to format the selected text as italic.

If no text is selected, the word under the cursor is formatted italic. This is a KToggleAction. The status is automatically updated when the text cursor is moved.

SupportUnderline 

Action to underline the selected text.

If no text is selected, the word under the cursor is underlined. This is a KToggleAction. The status is automatically updated when the text cursor is moved.

SupportStrikeOut 

Action to strike out the selected text.

If no text is selected, the word under the cursor is struck out. This is a KToggleAction. The status is automatically updated when the text cursor is moved.

SupportFontFamily 

Action to change the font family of the currently selected text.

If no text is selected, the font family of the word under the cursor is changed. Displayed as a combobox when inserted into the toolbar. This is a KFontAction. The status is automatically updated when the text cursor is moved.

SupportFontSize 

Action to change the font size of the currently selected text.

If no text is selected, the font size of the word under the cursor is changed. Displayed as a combobox when inserted into the toolbar. This is a KFontSizeAction. The status is automatically updated when the text cursor is moved.

SupportTextForegroundColor 

Action to change the text color of the currently selected text.

If no text is selected, the text color of the word under the cursor is changed. Opens a KColorDialog to select the color.

SupportTextBackgroundColor 

Action to change the background color of the currently selected text.

If no text is selected, the backgound color of the word under the cursor is changed. Opens a KColorDialog to select the color.

FullTextFormattingSupport 

A combination of all the falgs above.

Includes all actions that change the format of the text.

SupportChangeListStyle 

Action to make the current line a list element, change the list style or remove list formatting.

Displayed as a combobox when inserted into a toolbar. This is a KSelectAction. The status is automatically updated when the text cursor is moved.

SupportIndentLists 

Action to increase the current list nesting level.

This makes it possible to create nested lists.

SupportDedentLists 

Action to decrease the current list nesting level.

FullListSupport 

All of the three list actions above.

Includes all list-related actions.

SupportAlignment 

Actions to align the current paragraph left, righ, center or justify.

These actions are KToogleActions. The status is automatically updated when the text cursor is moved.

SupportRuleLine 

Action to insert a horizontal line.

SupportHyperlinks 

Action to convert the current text to a hyperlink.

If no text is selected, the word under the cursor is converted. This action opens a dialog where the user can enter the link target.

SupportFormatPainting 

Action to make the mouse cursor a format painter.

The user can select text with that painter. The selected text gets the same format as the text that was previously selected.

SupportToPlainText 

Action to change the text of the whole text edit to plain text.

All rich text formatting will get lost.

SupportSuperScriptAndSubScript 

Actions to format text as superscript or subscript.

If no text is selected, the word under the cursor is formatted as selected. This is a KToggleAction. The status is automatically updated when the text cursor is moved.

FullSupport 

Includes all above actions for full rich text support.

Definition at line 52 of file krichtextwidget.h.


Constructor & Destructor Documentation

KRichTextWidget::KRichTextWidget ( QWidget *  parent  )  [explicit]

Constructor.

Parameters:
parent the parent widget

Definition at line 176 of file krichtextwidget.cpp.

KRichTextWidget::KRichTextWidget ( const QString &  text,
QWidget *  parent = 0 
) [explicit]

Constructs a KRichTextWidget object.

Parameters:
text The initial text of the text edit, which is interpreted as HTML.
parent The parent widget

Definition at line 183 of file krichtextwidget.cpp.

KRichTextWidget::~KRichTextWidget (  ) 

Destructor.

Definition at line 190 of file krichtextwidget.cpp.


Member Function Documentation

void KRichTextWidget::createActions ( KActionCollection *  actionCollection  )  [virtual]

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

format_text_subscript & format_text_superscript

SupportSuperScriptAndSubScript

Parameters:
actionCollection the actions will be added to this action collection

Definition at line 205 of file krichtextwidget.cpp.

void KRichTextWidget::mouseReleaseEvent ( QMouseEvent *  event  )  [protected, virtual]

Reimplemented.

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

Definition at line 642 of file krichtextwidget.cpp.

KRichTextWidget::RichTextSupport KRichTextWidget::richTextSupport (  )  const

Returns the supported rich text subset available.

Returns:
The supported subset.

Definition at line 195 of file krichtextwidget.cpp.

void KRichTextWidget::setActionsEnabled ( bool  enabled  )  [slot]

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.

Parameters:
enabled Whether to enable or disable the actions.

Definition at line 505 of file krichtextwidget.cpp.

void KRichTextWidget::setRichTextSupport ( const KRichTextWidget::RichTextSupport &  support  ) 

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.

Parameters:
support The supported subset.

Definition at line 200 of file krichtextwidget.cpp.

void KRichTextWidget::updateActionStates (  ) 

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().

Definition at line 669 of file krichtextwidget.cpp.


The documentation for this class was generated from the following files:
  • krichtextwidget.h
  • krichtextwidget.cpp

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal