Sonnet::Speller Class
class Sonnet::Spellerclass used for actual spell checking. More...
Header: | #include <Sonnet/Speller> |
CMake: | find_package(KF6 REQUIRED COMPONENTS Sonnet) target_link_libraries(mytarget PRIVATE KF6::SonnetCore) |
Public Types
enum | Attribute { CheckUppercase, SkipRunTogether, AutoDetectLanguage } |
Public Functions
Speller(const QString &lang = QString()) | |
bool | addToPersonal(const QString &word) |
bool | addToSession(const QString &word) |
QStringList | availableBackends() const |
QMap<QString, QString> | availableDictionaries() const |
QStringList | availableLanguageNames() const |
QStringList | availableLanguages() const |
bool | checkAndSuggest(const QString &word, QStringList &suggestions) const |
QString | defaultClient() const |
QString | defaultLanguage() const |
bool | isCorrect(const QString &word) const |
bool | isMisspelled(const QString &word) const |
bool | isValid() const |
QString | language() const |
(since 5.54) QMap<QString, QString> | preferredDictionaries() const |
void | restore() |
void | save() |
void | setAttribute(Sonnet::Speller::Attribute attr, bool b = true) |
void | setDefaultClient(const QString &client) |
void | setDefaultLanguage(const QString &lang) |
void | setLanguage(const QString &lang) |
bool | storeReplacement(const QString &bad, const QString &good) |
QStringList | suggest(const QString &word) const |
bool | testAttribute(Sonnet::Speller::Attribute attr) const |
Detailed Description
Spell checker object.
Member Type Documentation
enum Speller::Attribute
Constant | Value |
---|---|
Sonnet::Speller::CheckUppercase | 0 |
Sonnet::Speller::SkipRunTogether | 1 |
Sonnet::Speller::AutoDetectLanguage | 2 |
Member Function Documentation
[explicit]
Speller::Speller(const QString &lang = QString())
bool Speller::addToPersonal(const QString &word)
Adds word to the list of of personal words. Returns true on success
bool Speller::addToSession(const QString &word)
Adds word to the words recognizable in the current session. Returns true on success
QStringList Speller::availableBackends() const
Returns names of all supported backends (e.g. ISpell, ASpell)
QMap<QString, QString> Speller::availableDictionaries() const
Returns a map of all available dictionaries with language descriptions and their codes. The key is the description, the code the value.
QStringList Speller::availableLanguageNames() const
Returns a localized list of names of supported languages.
Note: use availableDictionaries
QStringList Speller::availableLanguages() const
Returns a list of supported languages.
Note: use availableDictionaries
bool Speller::checkAndSuggest(const QString &word, QStringList &suggestions) const
Convenience method calling isCorrect() and suggest() if the word isn't correct.
QString Speller::defaultClient() const
See also setDefaultClient().
QString Speller::defaultLanguage() const
See also setDefaultLanguage().
bool Speller::isCorrect(const QString &word) const
Checks the given word. Returns false if the word is misspelled. true otherwise
bool Speller::isMisspelled(const QString &word) const
Checks the given word. Returns true if the word is misspelled. false otherwise
bool Speller::isValid() const
Returns true
if the speller supports currently selected language.
QString Speller::language() const
Returns language supported by this speller.
See also setLanguage().
[since 5.54]
QMap<QString, QString> Speller::preferredDictionaries() const
Returns a map of user preferred dictionaries with language descriptions and their codes. The key is the description, the code the value.
This function was introduced in 5.54.
void Speller::restore()
void Speller::save()
void Speller::setAttribute(Sonnet::Speller::Attribute attr, bool b = true)
void Speller::setDefaultClient(const QString &client)
See also defaultClient().
void Speller::setDefaultLanguage(const QString &lang)
See also defaultLanguage().
void Speller::setLanguage(const QString &lang)
Sets the language supported by this speller.
See also language().
bool Speller::storeReplacement(const QString &bad, const QString &good)
Stores user defined good replacement for the bad word.
Returns true
on success
QStringList Speller::suggest(const QString &word) const
Fetches suggestions for the word.
Returns list of all suggestions for the word