QtSpell
0.9.0
Spell checking for Qt text widgets
|
22 #if defined(QTSPELL_LIBRARY)
23 # define QTSPELL_API Q_DECL_EXPORT
25 # define QTSPELL_API Q_DECL_IMPORT
39 namespace enchant {
class Dict; }
57 class QTSPELL_API
Checker :
public QObject
84 bool setLanguage(
const QString& lang);
127 void addWordToDictionary(
const QString& word);
134 bool checkWord(
const QString& word)
const;
140 void ignoreWord(
const QString& word)
const;
147 QList<QString> getSpellingSuggestions(
const QString& word)
const;
154 static QList<QString> getLanguageList();
164 static QString decodeLanguageCode(
const QString& lang);
182 void showContextMenu(QMenu* menu,
const QPoint& pos,
int wordPos);
186 void slotIgnoreWord();
187 void slotReplaceWord();
188 void slotSetLanguage(
bool checked);
191 enchant::Dict* m_speller =
nullptr;
193 bool m_decodeCodes =
false;
194 bool m_spellingCheckbox =
false;
195 bool m_spellingEnabled =
true;
204 virtual QString
getWord(
int pos,
int* start = 0,
int* end = 0)
const = 0;
212 virtual void insertWord(
int start,
int end,
const QString& word) = 0;
219 bool setLanguageInternal(
const QString& lang);
249 void setTextEdit(QTextEdit* textEdit);
255 void setTextEdit(QPlainTextEdit* textEdit);
275 void checkSpelling(
int start = 0,
int end = -1);
284 void setUndoRedoEnabled(
bool enabled);
309 void clearUndoRedo();
331 TextEditProxy* m_textEdit =
nullptr;
332 QTextDocument* m_document =
nullptr;
333 UndoRedoStack* m_undoRedoStack =
nullptr;
334 bool m_undoRedoInProgress =
false;
335 Qt::ContextMenuPolicy m_oldContextMenuPolicy;
336 int m_noSpellingProperty = -1;
338 QString getWord(
int pos,
int* start = 0,
int* end = 0)
const;
339 void insertWord(
int start,
int end,
const QString& word);
341 void setTextEdit(TextEditProxy* textEdit);
342 bool eventFilter(QObject *obj, QEvent *event);
343 bool noSpellingPropertySet(
const QTextCursor& cursor)
const;
346 void slotShowContextMenu(
const QPoint& pos);
347 void slotCheckDocumentChanged();
348 void slotDetachTextEdit();
349 void slotCheckRange(
int pos,
int removed,
int added);
354 #endif // QTSPELL_HPP
int noSpellingPropertyId() const
Returns the current QTextCharFormat property identifier which marks whether a word ought to be spell-...
bool isAttached() const
Returns whether a widget is attached to the checker.
bool getSpellingEnabled() const
Return whether spellchecking is performed.
virtual bool isAttached() const =0
Returns whether a widget is attached to the checker.
void redoAvailable(bool available)
Emitted when the redo stak changes.
bool checkLanguageInstalled(const QString &lang)
Check whether the dictionary for a language is installed.
bool getShowCheckSpellingCheckbox() const
Return whether a "Check spelling" checkbox is displayed in the UI.
virtual void insertWord(int start, int end, const QString &word)=0
Replaces the specified range with the specified word.
void setDecodeLanguageCodes(bool decode)
Set whether to decode language codes in the UI.
void setSpellingEnabled(bool enabled)
Set whether spell checking should be performed.
void setNoSpellingPropertyId(int propertyId)
Set the QTextCharFormat property identifier which marks whether a word ought to be spell-checked.
const QString & getLanguage() const
Retreive the current spelling language.
void languageChanged(const QString &newLang)
This signal is emitted when the user selects a new language from the spellchecker UI.
virtual QString getWord(int pos, int *start=0, int *end=0) const =0
Get the word at the specified cursor position.
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.
An abstract class providing spell checking support.
Checker class for QTextEdit widgets.
void undoAvailable(bool available)
Emitted when the undo stack changes.
virtual void checkSpelling(int start=0, int end=-1)=0
Check the spelling.