# class KTextEdit

###

Module | kdeui
Namespace |
Class | KTextEdit
Inherits | QTextEdit

A KDE'ified QTextEdit

This is just a little subclass of QTextEdit, implementing some standard KDE features, like cursor auto-hiding, configurable wheelscrolling (fast-scroll or zoom), spell checking and deleting of entire words with Ctrl-Backspace or Ctrl-Delete.

This text edit provides two ways of spell checking: background checking, which will mark incorrectly spelled words red, and a spell check dialog, which lets the user check and correct all incorrectly spelled words.

Basic rule: whenever you want to use QTextEdit, use KTextEdit!

See also QTextEdit Author Carsten Pfeiffer <pfeiffer@kde.org>

### methods

- KTextEdit (text, parent)

  returns ctor
  KDE 4.1.0 and later only

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

  Constructs a KTextEdit object. See QTextEdit.QTextEdit for details.

- KTextEdit (parent)

  returns ctor
  KDE 4.1.0 and later only

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

  Constructs a KTextEdit object. See QTextEdit.QTextEdit for details.

- KTextEdit (a0, a1)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QString |
  a1 | QWidget | 0

- KTextEdit (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget | 0

- checkSpelling ( )

  returns Nothing

  Create a modal dialog to check the spelling. This slot will not return until spell checking has been completed.

- checkSpellingChanged (a0)

  returns Nothing
  SIGNAL ("checkSpellingChanged (bool)")
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  a0 | bool |

  emit signal when we activate or not autospellchecking

  @since 4.1

- checkSpellingEnabled ( )

  returns bool

  Returns true if background spell checking is enabled for this text edit. Note that it even returns true if this is a read-only KTextEdit, where spell checking is actually disabled. By default spell checking is disabled.

  See also setCheckSpellingEnabled()

- contextMenuEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QContextMenuEvent |

  Reimplemented from QTextEdit to add spelling related items when appropriate.

- createHighlighter ( )

  returns Nothing

  Allows to create a specific highlighter if reimplemented.

  By default, it creates a normal highlighter, based on the config file given to setSpellCheckingConfigFileName().

  This highlighter is set each time spell checking is toggled on by calling setCheckSpellingEnabled(), but can later be overridden by calling setHighlighter().

  See also setHighlighter()

  See also highlighter()

  See also setSpellCheckingConfigFileName()

- deleteWordBack ( )

  returns Nothing

  Deletes a word backwards from the current cursor position, if available.

- deleteWordForward ( )

  returns Nothing

  Deletes a word forwards from the current cursor position, if available.

- enableFindReplace (enabled)

  returns Nothing
  KDE 4.1.0 and later only

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

  Enable find replace action. @since 4.1

- event (a0)

  returns bool
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  a0 | QEvent |

  Reimplemented to catch "delete word" shortcut events.

- focusInEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QFocusEvent |

  Reimplemented to instantiate a KDictSpellingHighlighter, if spellchecking is enabled.

- highlightWord (length, pos)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  length | int |
  pos | int |

  Selects the characters at the specified position. Any previous selection will be lost. The cursor is moved to the first character of the new selection.

  length - The length of the selection, in number of characters

  pos - The position of the first character of the selection

- highlighter ( )

  returns Sonnet.Highlighter

  Returns the current highlighter, which is 0 if spell checking is disabled. The default highlighter is the one created by createHighlighter(), but might be overridden by setHighlighter().

  See also setHighlighter()

  See also createHighlighter()

- keyPressEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QKeyEvent |

  Reimplemented for internal reasons

- languageChanged (language)

  returns Nothing
  SIGNAL ("languageChanged (const QString&)")
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  language | QString |

  Emitted when the user changes the language in the spellcheck dialog shown by checkSpelling().

  language - the new language the user selected @since 4.1

- mousePopupMenu ( )

  returns QMenu
  KDE 4.1.0 and later only

  Return standard KTextEdit popupMenu @since 4.1

- replace ( )

  returns Nothing
  KDE 4.1.0 and later only

  Create replace dialogbox @since 4.1

- setCheckSpellingEnabled (check)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  check | bool |

  Turns background spell checking for this text edit on or off. Note that spell checking is only available in read-writable KTextEdits.

  Enabling spell checking will set back the current highlighter to the one returned by createHighlighter().

  See also checkSpellingEnabled()

  See also isReadOnly()

  See also setReadOnly()

- setHighlighter (_highLighter)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  _highLighter | Sonnet.Highlighter |

  Sets a custom backgound spell highlighter for this text edit. Normally, the highlighter returned by createHighlighter() will be used to detect and highlight incorrectly spelled words, but this function allows to set a custom highlighter.

  This has to be called after enabling spell checking with setCheckSpellingEnabled(), otherwise it has no effect.

  See also highlighter()

  See also createHighlighter()

  highLighter - the new highlighter which will be used now

- setReadOnly (readOnly)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  readOnly | bool |

  Reimplemented to set a proper "deactivated" background color.

- setSpellCheckingConfigFileName (fileName)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  fileName | QString |

  Allows to override the config file where the settings for spell checking, like the current language or encoding, are stored. By default, the global config file (kdeglobals) is used, to share spell check settings between all applications.

  This has to be called before any spell checking is initiated.

  fileName - the URL of the config file which will be used to read spell settings @bug this has no effect for the spell dialog, only for the background check

- setSpellCheckingLanguage (language)

  returns Nothing
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  language | QString |

  change default language for spell checking dialogbox @since 4.1

- slotDoFind ( )

  returns Nothing
  KDE 4.1.0 and later only

- slotDoReplace ( )

  returns Nothing
  KDE 4.1.0 and later only

  @since 4.1

- slotFind ( )

  returns Nothing
  KDE 4.1.0 and later only

- slotFindNext ( )

  returns Nothing
  KDE 4.1.0 and later only

- slotReplace ( )

  returns Nothing
  KDE 4.1.0 and later only

- slotReplaceNext ( )

  returns Nothing
  KDE 4.1.0 and later only

- spellCheckStatus (a0)

  returns Nothing
  SIGNAL ("spellCheckStatus (const QString&)")
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  a0 | QString |

  Signal sends when spell checking is finished/stopped/completed @since 4.1

- wheelEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QWheelEvent |

  Reimplemented to allow fast-wheelscrolling with Ctrl-Wheel or zoom.