22 #if defined(QTSPELL_LIBRARY)
23 # define QTSPELL_API Q_DECL_EXPORT
25 # define QTSPELL_API Q_DECL_IMPORT
38 namespace enchant {
class Dict; }
45 class QTSPELL_API
Checker :
public QObject
64 virtual void checkSpelling(
int start = 0,
int end = -1) = 0;
72 bool setLanguage(
const QString& lang);
115 void addWordToDictionary(
const QString& word);
122 bool checkWord(
const QString& word)
const;
128 void ignoreWord(
const QString& word)
const;
135 QList<QString> getSpellingSuggestions(
const QString& word)
const;
142 static QList<QString> getLanguageList();
152 static QString decodeLanguageCode(
const QString& lang);
167 void languageChanged(
const QString& newLang);
170 void showContextMenu(QMenu* menu,
const QPoint& pos,
int wordPos);
174 void slotIgnoreWord();
175 void slotReplaceWord();
176 void slotSetLanguage(
bool checked);
179 enchant::Dict* m_speller;
182 bool m_spellingCheckbox;
183 bool m_spellingEnabled;
193 virtual QString getWord(
int pos,
int* start = 0,
int* end = 0)
const = 0;
201 virtual void insertWord(
int start,
int end,
const QString& word) = 0;
207 virtual bool isAttached()
const = 0;
208 bool setLanguageInternal(
const QString& lang);
238 void setTextEdit(QTextEdit* textEdit);
244 void setTextEdit(QPlainTextEdit* textEdit);
246 void checkSpelling(
int start = 0,
int end = -1);
254 void clearUndoRedo();
263 void setUndoRedoEnabled(
bool enabled);
290 void undoAvailable(
bool available);
299 void redoAvailable(
bool available);
302 TextEditProxy* m_textEdit;
303 QTextDocument* m_document;
304 UndoRedoStack* m_undoRedoStack;
305 bool m_undoRedoInProgress;
306 Qt::ContextMenuPolicy m_oldContextMenuPolicy;
308 QString getWord(
int pos,
int* start = 0,
int* end = 0)
const;
309 void insertWord(
int start,
int end,
const QString& word);
311 void setTextEdit(TextEditProxy* textEdit);
312 bool eventFilter(QObject *obj, QEvent *event);
315 void slotShowContextMenu(
const QPoint& pos);
316 void slotCheckDocumentChanged();
317 void slotDetachTextEdit();
318 void slotCheckRange(
int pos,
int removed,
int added);
323 #endif // QTSPELL_HPP
bool getSpellingEnabled() const
Return whether spellchecking is performed.
bool isAttached() const
Returns whether a widget is attached to the checker.
const QString & getLanguage() const
Retreive the current spelling language.
bool getDecodeLanguageCodes() const
Return whether langauge codes are decoded in the UI.
void setDecodeLanguageCodes(bool decode)
Set whether to decode language codes in the UI.
Checker class for QTextEdit widgets.
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.
void setSpellingEnabled(bool enabled)
Set whether spell checking should be performed.
An abstract class providing spell checking support.