QtSpell 1.0.2
Spell checking for Qt text widgets
|
Checker class for QTextEdit widgets. More...
#include <QtSpell.hpp>
Inherits QtSpell::Checker.
Public Slots | |
void | undo () |
Undo the last edit operation. | |
void | redo () |
Redo the last edit operation. | |
void | clearUndoRedo () |
Clears the undo/redo stack. | |
Public Slots inherited from QtSpell::Checker | |
void | setSpellingEnabled (bool enabled) |
Set whether spell checking should be performed. |
Signals | |
void | undoAvailable (bool available) |
Emitted when the undo stack changes. | |
void | redoAvailable (bool available) |
Emitted when the redo stak changes. | |
Signals inherited from QtSpell::Checker | |
void | languageChanged (const QString &newLang) |
This signal is emitted when the user selects a new language from the spellchecker UI. |
Public Member Functions | |
TextEditChecker (QObject *parent=0) | |
TextEditChecker object constructor. | |
~TextEditChecker () | |
TextEditChecker object destructor. | |
void | setTextEdit (QTextEdit *textEdit) |
Set the QTextEdit to check. | |
void | setTextEdit (QPlainTextEdit *textEdit) |
Set the QPlainTextEdit to check. | |
void | setNoSpellingPropertyId (int propertyId) |
Set the QTextCharFormat property identifier which marks whether a word ought to be spell-checked. | |
int | noSpellingPropertyId () const |
Returns the current QTextCharFormat property identifier which marks whether a word ought to be spell-checked. | |
void | checkSpelling (int start=0, int end=-1) |
Check the spelling. | |
void | setUndoRedoEnabled (bool enabled) |
Sets whether undo/redo functionality is enabled. | |
Public Member Functions inherited from QtSpell::Checker | |
Checker (QObject *parent=0) | |
QtSpell::Checker object constructor. | |
virtual | ~Checker () |
QtSpell::Checker object destructor. | |
bool | setLanguage (const QString &lang) |
Set the spell checking language. | |
QString | getLanguage () const |
Retreive the current spelling language. | |
void | setDecodeLanguageCodes (bool decode) |
Set whether to decode language codes in the UI. | |
bool | getDecodeLanguageCodes () const |
Return whether langauge codes are decoded in the UI. | |
void | setShowCheckSpellingCheckbox (bool show) |
Set whether to display an "Check spelling" checkbox in the UI. | |
bool | getShowCheckSpellingCheckbox () const |
Return whether a "Check spelling" checkbox is displayed in the UI. | |
bool | getSpellingEnabled () const |
Return whether spellchecking is performed. | |
void | addWordToDictionary (const QString &word) |
Add the specified word to the user dictionary. | |
bool | checkWord (const QString &word) const |
Check the specified word. | |
void | ignoreWord (const QString &word) const |
Ignore a word for the current session. | |
QList< QString > | getSpellingSuggestions (const QString &word) const |
Retreive a list of spelling suggestions for the misspelled word. |
Private Member Functions | |
QString | getWord (int pos, int *start=0, int *end=0) const |
Get the word at the specified cursor position. | |
void | insertWord (int start, int end, const QString &word) |
Replaces the specified range with the specified word. | |
bool | isAttached () const |
Returns whether a widget is attached to the checker. |
Additional Inherited Members | |
Static Public Member Functions inherited from QtSpell::Checker | |
static QList< QString > | getLanguageList () |
Requests the list of languages available for spell checking. | |
static QString | decodeLanguageCode (const QString &lang) |
Translates a language code to a human readable format (i.e. "en_US" -> "English (United States)"). |
Checker class for QTextEdit widgets.
Sample usage:
Definition at line 220 of file QtSpell.hpp.
|
virtual |
Check the spelling.
start | The start position within the buffer. |
end | The end position within the buffer (-1 for the buffer end). |
Implements QtSpell::Checker.
Definition at line 201 of file TextEditChecker.cpp.
References QtSpell::Checker::checkWord(), QtSpell::TextCursor::isWordChar(), QtSpell::TextCursor::moveWordEnd(), QtSpell::TextCursor::nextChar(), and TextEditChecker().
|
slot |
Clears the undo/redo stack.
Definition at line 275 of file TextEditChecker.cpp.
References TextEditChecker().
|
privatevirtual |
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. |
Implements QtSpell::Checker.
Definition at line 301 of file TextEditChecker.cpp.
References QtSpell::TextCursor::moveWordEnd(), QtSpell::TextCursor::moveWordStart(), and TextEditChecker().
Referenced by redoAvailable().
|
privatevirtual |
Replaces the specified range with the specified word.
start | The start position. |
end | The end position. |
word | The word to insert. |
Implements QtSpell::Checker.
Definition at line 315 of file TextEditChecker.cpp.
References TextEditChecker().
Referenced by redoAvailable().
|
privatevirtual |
Returns whether a widget is attached to the checker.
Implements QtSpell::Checker.
Definition at line 415 of file TextEditChecker.cpp.
References TextEditChecker().
Referenced by redoAvailable().
int QtSpell::TextEditChecker::noSpellingPropertyId | ( | ) | const |
Returns the current QTextCharFormat property identifier which marks whether a word ought to be spell-checked.
Definition at line 180 of file TextEditChecker.cpp.
References TextEditChecker().
|
slot |
Redo the last edit operation.
Definition at line 404 of file TextEditChecker.cpp.
References TextEditChecker().
|
signal |
Emitted when the redo stak changes.
available | Whether redo steps are available. |
References getWord(), insertWord(), isAttached(), and TextEditChecker().
Referenced by setUndoRedoEnabled().
void QtSpell::TextEditChecker::setNoSpellingPropertyId | ( | int | propertyId | ) |
Set the QTextCharFormat property identifier which marks whether a word ought to be spell-checked.
propertyId | By default this is -1, meaning that no such property is set. To enable, pass a value above QTextFormat::UserProperty. |
Definition at line 174 of file TextEditChecker.cpp.
References TextEditChecker().
void QtSpell::TextEditChecker::setTextEdit | ( | QPlainTextEdit * | textEdit | ) |
Set the QPlainTextEdit to check.
textEdit | The QPlainTextEdit to check, or 0 to detach. |
Definition at line 120 of file TextEditChecker.cpp.
References TextEditChecker().
void QtSpell::TextEditChecker::setTextEdit | ( | QTextEdit * | textEdit | ) |
Set the QTextEdit to check.
textEdit | The QTextEdit to check, or 0 to detach. |
Definition at line 114 of file TextEditChecker.cpp.
References TextEditChecker().
void QtSpell::TextEditChecker::setUndoRedoEnabled | ( | bool | enabled | ) |
Sets whether undo/redo functionality is enabled.
enabled | Whether undo/redo is enabled. |
Definition at line 283 of file TextEditChecker.cpp.
References redoAvailable(), TextEditChecker(), and undoAvailable().
|
slot |
Undo the last edit operation.
Definition at line 393 of file TextEditChecker.cpp.
References TextEditChecker().
|
signal |
Emitted when the undo stack changes.
available | Whether undo steps are available. |
Referenced by setUndoRedoEnabled().