Sonnet
spellcheckhighlighter.cpp
308 connect(textDocument(), &QTextDocument::contentsChange, this, &SpellcheckHighlighter::contentsChange);
381 const bool selectedWordClicked = cursor.hasSelection() && mousePosition >= cursor.selectionStart() && mousePosition <= cursor.selectionEnd();
392 if (d->selectedWord.startsWith(QLatin1Char('\'')) || d->selectedWord.startsWith(QLatin1Char('\"'))) {
396 if (d->selectedWord.endsWith(QLatin1Char('\'')) || d->selectedWord.endsWith(QLatin1Char('\"'))) {
400 wordSelectCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, d->selectedWord.size());
406 if ((mousePosition < wordSelectCursor.selectionStart() || mousePosition >= wordSelectCursor.selectionEnd()) //
411 wordSelectCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, d->selectedWord.size());
413 d->wordIsMisspelled = isMouseCursorInsideWord && !d->selectedWord.isEmpty() && d->spellchecker->isMisspelled(d->selectedWord);
450 qCDebug(SONNET_LOG_QUICK) << "No dictionary for \"" << lang << "\" staying with the current language.";
623 if (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return || k->key() == Qt::Key_Up || k->key() == Qt::Key_Down || k->key() == Qt::Key_Left
624 || k->key() == Qt::Key_Right || k->key() == Qt::Key_PageUp || k->key() == Qt::Key_PageDown || k->key() == Qt::Key_Home || k->key() == Qt::Key_End
Q_INVOKABLE void replaceWord(const QString &word)
Replace word at the current cursor position.
Definition: spellcheckhighlighter.cpp:483
void setCurrentLanguage(const QString &language)
Set language to use for spell checking.
Definition: spellcheckhighlighter.cpp:444
KeyPress
SingleUnderline
void setDocument(QTextDocument *doc)
void clearSelection()
int selectionStart() const const
Q_INVOKABLE void addWordToDictionary(const QString &word)
Adds the given word permanently to the dictionary.
Definition: spellcheckhighlighter.cpp:471
bool wordIsMisspelled
This property holds whether the current word under the mouse is misspelled.
Definition: spellcheckhighlighter.h:72
singleShot
int count(const T &value) const const
QString selectedText() const const
void clear()
QString currentLanguage
This property holds the current language used for spell checking.
Definition: spellcheckhighlighter.h:84
QString wordUnderMouse
This property holds the current word under the mouse.
Definition: spellcheckhighlighter.h:76
int selectionStart
This property holds the start of the selection.
Definition: spellcheckhighlighter.h:64
bool active
This property holds whether spell checking is enabled.
Definition: spellcheckhighlighter.h:101
int cursorPosition
This property holds the current cursor position.
Definition: spellcheckhighlighter.h:60
QTextBlock block() const const
QTextBlock next() const const
MoveAnchor
Qt::KeyboardModifiers modifiers() const const
Q_SCRIPTABLE Q_NOREPLY void start()
Q_INVOKABLE QStringList suggestions(int position, int max=5)
Returns a list of suggested replacements for the given misspelled word.
Definition: spellcheckhighlighter.cpp:369
bool isSpace() const const
void setDocument(QTextDocument *document)
Set a new QTextDocument for this highlighter to operate on.
Definition: spellcheckhighlighter.cpp:509
QTextDocument * textDocument() const const
The Sonnet Highlighter class, used for drawing red lines in text fields when detecting spelling mista...
Definition: spellcheckhighlighter.h:51
void installEventFilter(QObject *filterObj)
QList< T > mid(int pos, int length) const const
void timeout()
bool isEmpty() const const
int position() const const
int length() const const
QTextBlockUserData * userData() const const
Key_Enter
int selectionEnd() const const
void select(QTextCursor::SelectionType selection)
WordUnderCursor
int positionInBlock() const const
void setPosition(int pos, QTextCursor::MoveMode m)
int key() const const
QEvent::Type type() const const
Q_INVOKABLE void ignoreWord(const QString &word)
Ignores the given word.
Definition: spellcheckhighlighter.cpp:477
const QChar at(int position) const const
void insertText(const QString &text)
NextCharacter
void slotAutoDetection()
Run auto detection, disabling spell checking if too many errors are found.
Definition: spellcheckhighlighter.cpp:215
bool autoDetectLanguageDisabled
This property holds whether the automatic language detection is disabled overriding the Sonnet global...
Definition: spellcheckhighlighter.h:111
bool hasSelection() const const
bool automatic
This property holds whether spell checking is automatically disabled if there's too many errors.
Definition: spellcheckhighlighter.h:106
Q_INVOKABLE bool isWordMisspelled(const QString &word)
Checks if a given word is marked as misspelled by the highlighter.
Definition: spellcheckhighlighter.cpp:610
void contentsChange(int position, int charsRemoved, int charsAdded)
ControlModifier
bool movePosition(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode, int n)
QObject * parent() const const
red
int position() const const
bool isValid() const const
bool spellCheckerFound
This property holds whether a spell checking backend with support for the currentLanguage was found.
Definition: spellcheckhighlighter.h:89
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Sep 27 2023 03:55:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Sep 27 2023 03:55:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.