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

KDEUI

KTextEdit Class Reference

A KDE'ified QTextEdit. More...

#include <ktextedit.h>

Inheritance diagram for KTextEdit:

Inheritance graph
[legend]

List of all members.


Public Slots

void checkSpelling ()
void replace ()
void setSpellCheckingLanguage (const QString &language)
void showSpellConfigDialog (const QString &configFileName, const QString &windowIcon=QString())

Signals

void checkSpellingChanged (bool)
void languageChanged (const QString &language)
void spellCheckStatus (const QString &)

Public Member Functions

bool checkSpellingEnabled () const
virtual void createHighlighter ()
void enableFindReplace (bool enabled)
Sonnet::Highlighter * highlighter () const
void highlightWord (int length, int pos)
 KTextEdit (QWidget *parent=0)
 KTextEdit (const QString &text, QWidget *parent=0)
QMenu * mousePopupMenu ()
void setCheckSpellingEnabled (bool check)
void setHighlighter (Sonnet::Highlighter *_highLighter)
virtual void setReadOnly (bool readOnly)
void setSpellCheckingConfigFileName (const QString &fileName)
void setSpellInterface (KTextEditSpellInterface *spellInterface)
const QString & spellCheckingLanguage () const
 ~KTextEdit ()

Protected Slots

void slotDoFind ()
void slotDoReplace ()
void slotFind ()
void slotFindNext ()
void slotReplace ()
void slotReplaceNext ()

Protected Member Functions

bool checkSpellingEnabledInternal () const
virtual void contextMenuEvent (QContextMenuEvent *)
virtual void deleteWordBack ()
virtual void deleteWordForward ()
virtual bool event (QEvent *)
virtual void focusInEvent (QFocusEvent *)
virtual void keyPressEvent (QKeyEvent *)
void setCheckSpellingEnabledInternal (bool check)
virtual void wheelEvent (QWheelEvent *)

Detailed Description

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>

Definition at line 84 of file ktextedit.h.


Constructor & Destructor Documentation

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

Constructs a KTextEdit object.

See QTextEdit::QTextEdit for details.

Definition at line 226 of file ktextedit.cpp.

KTextEdit::KTextEdit ( QWidget *  parent = 0  )  [explicit]

Constructs a KTextEdit object.

See QTextEdit::QTextEdit for details.

Definition at line 232 of file ktextedit.cpp.

KTextEdit::~KTextEdit (  ) 

Destroys the KTextEdit object.

Definition at line 238 of file ktextedit.cpp.


Member Function Documentation

void KTextEdit::checkSpelling (  )  [slot]

Create a modal dialog to check the spelling.

This slot will not return until spell checking has been completed.

Definition at line 673 of file ktextedit.cpp.

void KTextEdit::checkSpellingChanged ( bool   )  [signal]

emit signal when we activate or not autospellchecking

Since:
4.1

bool KTextEdit::checkSpellingEnabled (  )  const

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.

If a spell interface is set by setSpellInterface(), the call will be delegated to there instead.

See also:
setCheckSpellingEnabled()

Definition at line 628 of file ktextedit.cpp.

bool KTextEdit::checkSpellingEnabledInternal (  )  const [protected]

Checks whether spellchecking is enabled or disabled.

This is what checkSpellingEnabled calls if there is no spell interface.

Since:
4.2

Definition at line 636 of file ktextedit.cpp.

void KTextEdit::contextMenuEvent ( QContextMenuEvent *  event  )  [protected, virtual]

Reimplemented from QTextEdit to add spelling related items when appropriate.

Reimplemented from QTextEdit.

Definition at line 455 of file ktextedit.cpp.

void KTextEdit::createHighlighter (  )  [virtual]

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

highlighter()

setSpellCheckingConfigFileName()

Definition at line 570 of file ktextedit.cpp.

void KTextEdit::deleteWordBack (  )  [protected, virtual]

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

Definition at line 376 of file ktextedit.cpp.

void KTextEdit::deleteWordForward (  )  [protected, virtual]

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

Definition at line 384 of file ktextedit.cpp.

void KTextEdit::enableFindReplace ( bool  enabled  ) 

Enable find replace action.

Since:
4.1

Definition at line 866 of file ktextedit.cpp.

bool KTextEdit::event ( QEvent *  ev  )  [protected, virtual]

Reimplemented to catch "delete word" shortcut events.

Definition at line 282 of file ktextedit.cpp.

void KTextEdit::focusInEvent ( QFocusEvent *  event  )  [protected, virtual]

Reimplemented to instantiate a KDictSpellingHighlighter, if spellchecking is enabled.

Definition at line 620 of file ktextedit.cpp.

Sonnet::Highlighter * KTextEdit::highlighter (  )  const

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

createHighlighter()

Definition at line 575 of file ktextedit.cpp.

void KTextEdit::highlightWord ( int  length,
int  pos 
)

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.

Parameters:
length The length of the selection, in number of characters
pos The position of the first character of the selection

Definition at line 706 of file ktextedit.cpp.

void KTextEdit::keyPressEvent ( QKeyEvent *  event  )  [protected, virtual]

Reimplemented for internal reasons.

Reimplemented in KRichTextEdit.

Definition at line 921 of file ktextedit.cpp.

void KTextEdit::languageChanged ( const QString &  language  )  [signal]

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

Parameters:
language the new language the user selected
Since:
4.1

QMenu * KTextEdit::mousePopupMenu (  ) 

Return standard KTextEdit popupMenu.

Since:
4.1

Definition at line 392 of file ktextedit.cpp.

void KTextEdit::replace (  )  [slot]

Create replace dialogbox.

Since:
4.1

Definition at line 715 of file ktextedit.cpp.

void KTextEdit::setCheckSpellingEnabled ( bool  check  ) 

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

If a spell interface is set by setSpellInterface(), the call will be delegated to there instead.

See also:
checkSpellingEnabled()

isReadOnly()

setReadOnly()

Definition at line 586 of file ktextedit.cpp.

void KTextEdit::setCheckSpellingEnabledInternal ( bool  check  )  [protected]

Enable or disable the spellchecking.

This is what setCheckSpellingEnabled() calls if there is no spell interface.

Since:
4.2

Definition at line 594 of file ktextedit.cpp.

void KTextEdit::setHighlighter ( Sonnet::Highlighter *  _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()

createHighlighter()

Parameters:
highLighter the new highlighter which will be used now

Definition at line 580 of file ktextedit.cpp.

void KTextEdit::setReadOnly ( bool  readOnly  )  [virtual]

Reimplemented to set a proper "deactivated" background color.

Definition at line 641 of file ktextedit.cpp.

void KTextEdit::setSpellCheckingConfigFileName ( const QString &  fileName  ) 

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.

Parameters:
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

Definition at line 243 of file ktextedit.cpp.

void KTextEdit::setSpellCheckingLanguage ( const QString &  language  )  [slot]

Set the spell check language which will be used for highlighting spelling mistakes and for the spellcheck dialog.

The languageChanged() signal will be emitted when the new language is different from the old one.

Since:
4.1

Definition at line 253 of file ktextedit.cpp.

void KTextEdit::setSpellInterface ( KTextEditSpellInterface *  spellInterface  ) 

Sets the spell interface, which is used to delegate certain function calls to the interface.

This is a workaround for binary compatibility and should be removed in KDE5.

Since:
4.2

Definition at line 871 of file ktextedit.cpp.

void KTextEdit::showSpellConfigDialog ( const QString &  configFileName,
const QString &  windowIcon = QString() 
) [slot]

Opens a Sonnet::ConfigDialog for this text edit.

The config settings the user makes are read from and stored to the given config file. The spellcheck language of the config dialog is set to the current spellcheck language of the textedit. If the user changes the language in that dialog, the languageChanged() signal is emitted.

Parameters:
configFileName The file which is used to store and load the config settings
windowIcon the icon which is used for the titlebar of the spell dialog window. Can be empty, then no icon is set.
Since:
4.2

Definition at line 268 of file ktextedit.cpp.

void KTextEdit::slotDoFind (  )  [protected, slot]

Definition at line 788 of file ktextedit.cpp.

void KTextEdit::slotDoReplace (  )  [protected, slot]

Since:
4.1

Definition at line 730 of file ktextedit.cpp.

void KTextEdit::slotFind (  )  [protected, slot]

Definition at line 836 of file ktextedit.cpp.

void KTextEdit::slotFindNext (  )  [protected, slot]

Definition at line 814 of file ktextedit.cpp.

void KTextEdit::slotReplace (  )  [protected, slot]

Definition at line 851 of file ktextedit.cpp.

void KTextEdit::slotReplaceNext (  )  [protected, slot]

Definition at line 757 of file ktextedit.cpp.

const QString & KTextEdit::spellCheckingLanguage (  )  const

Returns:
the spell checking language which was set by setSpellCheckingLanguage(), the spellcheck dialog or the spellcheck config dialog, or an empty string if that has never been called.
Since:
4.2

Definition at line 248 of file ktextedit.cpp.

void KTextEdit::spellCheckStatus ( const QString &   )  [signal]

Signal sends when spell checking is finished/stopped/completed.

Since:
4.1

void KTextEdit::wheelEvent ( QWheelEvent *  event  )  [protected, virtual]

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

Definition at line 562 of file ktextedit.cpp.


The documentation for this class was generated from the following files:
  • ktextedit.h
  • ktextedit.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
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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