QtSpell
0.8.1
Spell checking for Qt text widgets
|
An abstract class providing spell checking support. More...
#include <QtSpell.hpp>
Inherits QObject.
Inherited by QtSpell::TextEditChecker.
Public Slots | |
void | setSpellingEnabled (bool enabled) |
Set whether spell checking should be performed. More... | |
Signals | |
void | languageChanged (const QString &newLang) |
This signal is emitted when the user selects a new language from the spellchecker UI. More... | |
Public Member Functions | |
Checker (QObject *parent=0) | |
QtSpell::Checker object constructor. | |
virtual | ~Checker () |
QtSpell::Checker object destructor. | |
virtual void | checkSpelling (int start=0, int end=-1)=0 |
Check the spelling. More... | |
bool | setLanguage (const QString &lang) |
Set the spell checking language. More... | |
const QString & | getLanguage () const |
Retreive the current spelling language. More... | |
void | setDecodeLanguageCodes (bool decode) |
Set whether to decode language codes in the UI. More... | |
bool | getDecodeLanguageCodes () const |
Return whether langauge codes are decoded in the UI. More... | |
void | setShowCheckSpellingCheckbox (bool show) |
Set whether to display an "Check spelling" checkbox in the UI. More... | |
bool | getShowCheckSpellingCheckbox () const |
Return whether a "Check spelling" checkbox is displayed in the UI. More... | |
bool | getSpellingEnabled () const |
Return whether spellchecking is performed. More... | |
void | addWordToDictionary (const QString &word) |
Add the specified word to the user dictionary. More... | |
bool | checkWord (const QString &word) const |
Check the specified word. More... | |
void | ignoreWord (const QString &word) const |
Ignore a word for the current session. More... | |
QList< QString > | getSpellingSuggestions (const QString &word) const |
Retreive a list of spelling suggestions for the misspelled word. More... | |
Static Public Member Functions | |
static QList< QString > | getLanguageList () |
Requests the list of languages available for spell checking. More... | |
static QString | decodeLanguageCode (const QString &lang) |
Translates a language code to a human readable format (i.e. "en_US" -> "English (United States)"). More... | |
Private Member Functions | |
virtual QString | getWord (int pos, int *start=0, int *end=0) const =0 |
Get the word at the specified cursor position. More... | |
virtual void | insertWord (int start, int end, const QString &word)=0 |
Replaces the specified range with the specified word. More... | |
virtual bool | isAttached () const =0 |
Returns whether a widget is attached to the checker. More... | |
An abstract class providing spell checking support.
Definition at line 57 of file QtSpell.hpp.
void QtSpell::Checker::addWordToDictionary | ( | const QString & | word | ) |
Add the specified word to the user dictionary.
word | The word to add to the dictionary |
Definition at line 119 of file Checker.cpp.
Referenced by decodeLanguageCode().
|
pure virtual |
Check the spelling.
start | The start position within the buffer. |
end | The end position within the buffer (-1 for the buffer end). |
Implemented in QtSpell::TextEditChecker.
Referenced by decodeLanguageCode(), and setLanguage().
bool QtSpell::Checker::checkWord | ( | const QString & | word | ) | const |
Check the specified word.
word | A word. |
Definition at line 126 of file Checker.cpp.
Referenced by QtSpell::TextEditChecker::checkSpelling(), and decodeLanguageCode().
|
static |
Translates a language code to a human readable format (i.e. "en_US" -> "English (United States)").
lang | The language locale specifier. |
Definition at line 169 of file Checker.cpp.
References addWordToDictionary(), checkSpelling(), checkWord(), getDecodeLanguageCodes(), getLanguage(), getLanguageList(), getSpellingSuggestions(), getWord(), ignoreWord(), insertWord(), QtSpell::Codetable::instance(), languageChanged(), QtSpell::Codetable::lookup(), setLanguage(), and setSpellingEnabled().
|
inline |
Return whether langauge codes are decoded in the UI.
Definition at line 103 of file QtSpell.hpp.
Referenced by decodeLanguageCode().
|
inline |
Retreive the current spelling language.
Definition at line 90 of file QtSpell.hpp.
Referenced by decodeLanguageCode().
|
static |
Requests the list of languages available for spell checking.
Definition at line 160 of file Checker.cpp.
Referenced by decodeLanguageCode().
|
inline |
Return whether a "Check spelling" checkbox is displayed in the UI.
Definition at line 115 of file QtSpell.hpp.
|
inline |
Return whether spellchecking is performed.
Definition at line 121 of file QtSpell.hpp.
QList< QString > QtSpell::Checker::getSpellingSuggestions | ( | const QString & | word | ) | const |
Retreive a list of spelling suggestions for the misspelled word.
word | The misspelled word. |
Definition at line 147 of file Checker.cpp.
Referenced by decodeLanguageCode().
|
privatepure virtual |
Get the word at the specified cursor position.
pos | The cursor position. |
start | If not 0, will contain the start position of the word. |
end | If not 0, will contain the end position of the word. |
Implemented in QtSpell::TextEditChecker.
Referenced by decodeLanguageCode().
void QtSpell::Checker::ignoreWord | ( | const QString & | word | ) | const |
Ignore a word for the current session.
word | The word to ignore. |
Definition at line 142 of file Checker.cpp.
Referenced by decodeLanguageCode().
|
privatepure virtual |
Replaces the specified range with the specified word.
start | The start position. |
end | The end position. |
word | The word to insert. |
Implemented in QtSpell::TextEditChecker.
Referenced by decodeLanguageCode().
|
privatepure virtual |
Returns whether a widget is attached to the checker.
Implemented in QtSpell::TextEditChecker.
Referenced by setLanguage().
|
signal |
This signal is emitted when the user selects a new language from the spellchecker UI.
newLang | The new language, as a locale specifier. |
Referenced by decodeLanguageCode().
|
inline |
Set whether to decode language codes in the UI.
decode | Whether to decode the language codes. |
Definition at line 97 of file QtSpell.hpp.
bool QtSpell::Checker::setLanguage | ( | const QString & | lang | ) |
Set the spell checking language.
lang | The language, as a locale specifier (i.e. "en_US"), or an empty string to attempt to use the system locale. |
Definition at line 82 of file Checker.cpp.
References checkSpelling(), and isAttached().
Referenced by decodeLanguageCode().
|
inline |
Set whether to display an "Check spelling" checkbox in the UI.
show | Whether to display an "Check spelling" checkbox in the UI. |
Definition at line 109 of file QtSpell.hpp.
|
inlineslot |
Set whether spell checking should be performed.
enabled | True if spell checking should be performed. |
Definition at line 171 of file QtSpell.hpp.
Referenced by decodeLanguageCode().