KTextWidgets 5.109.0
|
A KDE'ified QTextEdit. More...
#include <KTextEdit>
Properties | |
bool | checkSpellingEnabled |
QString | spellCheckingLanguage |
Signals | |
void | aboutToShowContextMenu (QMenu *menu) |
Emitted before the context menu is displayed. | |
void | checkSpellingChanged (bool) |
emit signal when we activate or not autospellchecking | |
void | languageChanged (const QString &language) |
Emitted when the user changes the language in the spellcheck dialog shown by checkSpelling() or when calling setSpellCheckingLanguage(). | |
void | spellCheckerAutoCorrect (const QString ¤tWord, const QString &autoCorrectWord) |
void | spellCheckingCanceled () |
signal spellCheckingCanceled is sent when we cancel spell checking. | |
void | spellCheckingFinished () |
signal spellCheckingFinished is sent when we finish spell check or we click on "Terminate" button in sonnet dialogbox | |
void | spellCheckStatus (const QString &) |
Signal sends when spell checking is finished/stopped/completed. | |
Public Slots | |
void | addTextDecorator (Sonnet::SpellCheckDecorator *decorator) |
Add custom spell checker decorator. | |
void | checkSpelling () |
Show a dialog to check the spelling. | |
void | clearDecorator () |
clearDecorator clear the spellcheckerdecorator | |
void | replace () |
Create replace dialogbox. | |
void | setSpellCheckingLanguage (const QString &language) |
Set the spell check language which will be used for highlighting spelling mistakes and for the spellcheck dialog. | |
void | showSpellConfigDialog (const QString &windowIcon=QString()) |
Opens a Sonnet::ConfigDialog for this text edit. | |
Public Member Functions | |
KTextEdit (const QString &text, QWidget *parent=nullptr) | |
Constructs a KTextEdit object. | |
KTextEdit (QWidget *parent=nullptr) | |
Constructs a KTextEdit object. | |
~KTextEdit () override | |
Destroys the KTextEdit object. | |
virtual bool | checkSpellingEnabled () const |
Returns true if background spell checking is enabled for this text edit. | |
virtual void | createHighlighter () |
Allows to create a specific highlighter if reimplemented. | |
void | enableFindReplace (bool enabled) |
Enable find replace action. | |
void | forceSpellChecking () |
Sonnet::Highlighter * | highlighter () const |
Returns the current highlighter, which is 0 if spell checking is disabled. | |
void | highlightWord (int length, int pos) |
Selects the characters at the specified position. | |
virtual QMenu * | mousePopupMenu () |
Return standard KTextEdit popupMenu. | |
virtual void | setCheckSpellingEnabled (bool check) |
Turns background spell checking for this text edit on or off. | |
void | setHighlighter (Sonnet::Highlighter *_highLighter) |
Sets a custom background spell highlighter for this text edit. | |
virtual void | setReadOnly (bool readOnly) |
Reimplemented to set a proper "deactivated" background color. | |
virtual bool | shouldBlockBeSpellChecked (const QString &block) const |
Returns true if the given paragraph or block should be spellcheck. | |
void | showAutoCorrectButton (bool show) |
void | showTabAction (bool show) |
const QString & | spellCheckingLanguage () const |
Protected Slots | |
void | slotDoFind () |
void | slotDoReplace () |
void | slotFind () |
void | slotFindNext () |
void | slotFindPrevious () |
void | slotReplace () |
void | slotReplaceNext () |
void | slotSpeakText () |
Protected Member Functions | |
KTEXTWIDGETS_NO_EXPORT | KTextEdit (KTextEditPrivate &dd, const QString &text, QWidget *parent) |
KTEXTWIDGETS_NO_EXPORT | KTextEdit (KTextEditPrivate &dd, QWidget *parent) |
void | contextMenuEvent (QContextMenuEvent *) override |
Reimplemented from QTextEdit to add spelling related items when appropriate. | |
virtual void | deleteWordBack () |
Deletes a word backwards from the current cursor position, if available. | |
virtual void | deleteWordForward () |
Deletes a word forwards from the current cursor position, if available. | |
bool | event (QEvent *) override |
Reimplemented to catch "delete word" shortcut events. | |
void | focusInEvent (QFocusEvent *) override |
Reimplemented to instantiate a KDictSpellingHighlighter, if spellchecking is enabled. | |
void | keyPressEvent (QKeyEvent *) override |
Reimplemented for internal reasons. | |
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!
|
explicit |
Constructs a KTextEdit object.
See QTextEdit::QTextEdit for details.
|
explicit |
Constructs a KTextEdit object.
See QTextEdit::QTextEdit for details.
|
override |
Destroys the KTextEdit object.
|
signal |
Emitted before the context menu is displayed.
The signal allows you to add your own entries into the the context menu that is created on demand.
NOTE: Do not store the pointer to the QMenu provided through since it is created and deleted on demand.
p | the context menu about to be displayed |
|
slot |
Add custom spell checker decorator.
|
slot |
Show a dialog to check the spelling.
The spellCheckStatus() signal will be emitted when the spell checking dialog is closed.
|
signal |
emit signal when we activate or not autospellchecking
|
virtual |
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.
|
slot |
clearDecorator clear the spellcheckerdecorator
|
overrideprotected |
Reimplemented from QTextEdit to add spelling related items when appropriate.
|
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().
|
protectedvirtual |
Deletes a word backwards from the current cursor position, if available.
|
protectedvirtual |
Deletes a word forwards from the current cursor position, if available.
void KTextEdit::enableFindReplace | ( | bool | enabled | ) |
Enable find replace action.
|
overrideprotected |
Reimplemented to catch "delete word" shortcut events.
|
overrideprotected |
Reimplemented to instantiate a KDictSpellingHighlighter, if spellchecking is enabled.
void KTextEdit::forceSpellChecking | ( | ) |
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().
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.
length | The length of the selection, in number of characters |
pos | The position of the first character of the selection |
|
overrideprotected |
Reimplemented for internal reasons.
|
signal |
Emitted when the user changes the language in the spellcheck dialog shown by checkSpelling() or when calling setSpellCheckingLanguage().
language | the new language the user selected |
|
virtual |
Return standard KTextEdit popupMenu.
|
slot |
Create replace dialogbox.
|
virtual |
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().
void KTextEdit::setHighlighter | ( | Sonnet::Highlighter * | _highLighter | ) |
Sets a custom background 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.
Ownership is transferred to the KTextEdit
highLighter | the new highlighter which will be used now |
|
virtual |
Reimplemented to set a proper "deactivated" background color.
|
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.
|
virtual |
Returns true if the given paragraph or block should be spellcheck.
For example, a mail client does not want to check quoted text, and would return false here (by checking whether the block starts with a quote sign).
Always returns true by default.
void KTextEdit::showAutoCorrectButton | ( | bool | show | ) |
|
slot |
Opens a Sonnet::ConfigDialog for this text edit.
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.
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. |
void KTextEdit::showTabAction | ( | bool | show | ) |
|
protectedslot |
|
protectedslot |
|
protectedslot |
|
signal |
|
signal |
signal spellCheckingCanceled is sent when we cancel spell checking.
|
signal |
signal spellCheckingFinished is sent when we finish spell check or we click on "Terminate" button in sonnet dialogbox
const QString & KTextEdit::spellCheckingLanguage | ( | ) | const |
|
signal |
Signal sends when spell checking is finished/stopped/completed.