Sonnet::Highlighter
#include <highlighter.h>
Signals | |
void | activeChanged (const QString &description) |
Public Slots | |
void | setCurrentLanguage (const QString &language) |
void | slotAutoDetection () |
void | slotRehighlight () |
Detailed Description
The Sonnet Highlighter class, used for drawing pretty red lines in text fields.
Definition at line 25 of file highlighter.h.
Constructor & Destructor Documentation
◆ Highlighter() [1/2]
Definition at line 142 of file highlighter.cpp.
◆ Highlighter() [2/2]
|
explicit |
- Parameters
-
textEdit col define spellchecking color.
- Since
- 5.12
Definition at line 151 of file highlighter.cpp.
◆ ~Highlighter()
|
override |
Definition at line 161 of file highlighter.cpp.
Member Function Documentation
◆ activeChanged
Emitted when as-you-type spell checking is enabled or disabled.
- Parameters
-
description is a i18n description of the new state, with an optional reason
◆ addWordToDictionary()
Adds the given word permanently to the dictionary.
It will never be marked as misspelled again, even after restarting the application.
- Parameters
-
word the word which will be added to the dictionary
- Since
- 4.1
Definition at line 469 of file highlighter.cpp.
◆ autoDetectLanguageDisabled()
bool Sonnet::Highlighter::autoDetectLanguageDisabled | ( | ) | const |
Returns whether the automatic language detection is disabled, overriding the Sonnet settings.
- Returns
- true if the automatic language detection is disabled
- Since
- 5.71
Definition at line 204 of file highlighter.cpp.
◆ automatic()
bool Sonnet::Highlighter::automatic | ( | ) | const |
Returns the state of the automatic disabling of spell checking.
- Returns
- true if spell checking is automatically disabled if there's too many errors
Definition at line 199 of file highlighter.cpp.
◆ checkerEnabledByDefault()
bool Sonnet::Highlighter::checkerEnabledByDefault | ( | ) | const |
Return true if checker is enabled by default.
- Since
- 4.5
Definition at line 514 of file highlighter.cpp.
◆ currentLanguage()
QString Sonnet::Highlighter::currentLanguage | ( | ) | const |
Returns the current language used for spell checking.
- Returns
- the language code for the current language.
Definition at line 375 of file highlighter.cpp.
◆ eventFilter()
Reimplemented from QObject.
Definition at line 411 of file highlighter.cpp.
◆ highlightBlock()
Implements QSyntaxHighlighter.
Definition at line 315 of file highlighter.cpp.
◆ ignoreWord()
Ignores the given word.
This word will not be marked misspelled for this session. It will again be marked as misspelled when creating new highlighters.
- Parameters
-
word the word which will be ignored
- Since
- 4.1
Definition at line 474 of file highlighter.cpp.
◆ intraWordEditing()
|
protected |
Definition at line 209 of file highlighter.cpp.
◆ isActive()
bool Sonnet::Highlighter::isActive | ( | ) | const |
Returns the state of spell checking.
- Returns
- true if spell checking is active
- See also
- setActive()
Definition at line 286 of file highlighter.cpp.
◆ isWordMisspelled()
Checks if a given word is marked as misspelled by the highlighter.
- Parameters
-
word the word to be checked
- Returns
- true if the given word is misspelled.
- Since
- 4.1
Definition at line 504 of file highlighter.cpp.
◆ setActive()
void Sonnet::Highlighter::setActive | ( | bool | active | ) |
Enable/Disable spell checking.
If active
is true then spell checking is enabled; otherwise it is disabled. Note that you have to disable automatic (de)activation with setAutomatic() before you change the state of spell checking if you want to persistently enable/disable spell checking.
- Parameters
-
active if true, then spell checking is enabled
- See also
- isActive(), setAutomatic()
Definition at line 271 of file highlighter.cpp.
◆ setAutoDetectLanguageDisabled()
void Sonnet::Highlighter::setAutoDetectLanguageDisabled | ( | bool | autoDetectDisabled | ) |
Sets whether to disable the automatic language detection.
- Parameters
-
autoDetectDisabled if true, the language will not be detected automatically by the spell checker, even if the option is enabled in the Sonnet settings.
- Since
- 5.71
Definition at line 231 of file highlighter.cpp.
◆ setAutomatic()
void Sonnet::Highlighter::setAutomatic | ( | bool | automatic | ) |
Sets whether to automatically disable spell checking if there's too many errors.
- Parameters
-
automatic if true, spell checking will be disabled if there's a significant amount of errors.
Definition at line 219 of file highlighter.cpp.
◆ setCurrentLanguage
Set language to use for spell checking.
- Parameters
-
language the language code for the new language to use.
Definition at line 380 of file highlighter.cpp.
◆ setDocument()
void Sonnet::Highlighter::setDocument | ( | QTextDocument * | document | ) |
Set a new QTextDocument for this highlighter to operate on.
- Parameters
-
document the new document to operate on.
Definition at line 519 of file highlighter.cpp.
◆ setIntraWordEditing()
|
protected |
Definition at line 214 of file highlighter.cpp.
◆ setMisspelled()
|
protectedvirtual |
Definition at line 397 of file highlighter.cpp.
◆ setMisspelledColor()
Sets the color in which the highlighter underlines misspelled words.
- Since
- 4.2
Definition at line 509 of file highlighter.cpp.
◆ slotAutoDetection
|
slot |
Run auto detection, disabling spell checking if too many errors are found.
Definition at line 236 of file highlighter.cpp.
◆ slotRehighlight
|
slot |
Force a new highlighting.
Definition at line 175 of file highlighter.cpp.
◆ spellCheckerFound()
bool Sonnet::Highlighter::spellCheckerFound | ( | ) | const |
Returns whether a spell checking backend with support for the currentLanguage was found.
- Returns
- true if spell checking is supported for the current language.
Definition at line 170 of file highlighter.cpp.
◆ suggestionsForWord() [1/2]
QStringList Sonnet::Highlighter::suggestionsForWord | ( | const QString & | word, |
const QTextCursor & | cursor, | ||
int | max = 10 ) |
Returns a list of suggested replacements for the given misspelled word.
If the word is not misspelled, the list will be empty.
- Parameters
-
word the misspelled word cursor the cursor pointing to the beginning of that word. This is used to determine the language to use, when AutoDetectLanguage is enabled. max at most this many suggestions will be returned. If this is -1, as many suggestions as the spell backend supports will be returned.
- Returns
- a list of suggested replacements for the word
- Since
- 5.42
Definition at line 488 of file highlighter.cpp.
◆ suggestionsForWord() [2/2]
QStringList Sonnet::Highlighter::suggestionsForWord | ( | const QString & | word, |
int | max = 10 ) |
Returns a list of suggested replacements for the given misspelled word.
If the word is not misspelled, the list will be empty.
- Parameters
-
word the misspelled word max at most this many suggestions will be returned. If this is -1, as many suggestions as the spell backend supports will be returned.
- Returns
- a list of suggested replacements for the word
- Since
- 4.1
Definition at line 479 of file highlighter.cpp.
◆ unsetMisspelled()
|
protectedvirtual |
Definition at line 406 of file highlighter.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:15:10 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.