Sonnet
spellcheckhighlighter.cpp
325 connect(textDocument(), &QTextDocument::contentsChange, this, &SpellcheckHighlighter::contentsChange);
375 if (word.position() + offset <= cursor.position() && cursor.position() <= word.position() + offset + word.length()) {
404 const bool selectedWordClicked = cursor.hasSelection() && mousePosition >= cursor.selectionStart() && mousePosition <= cursor.selectionEnd();
415 if (d->selectedWord.startsWith(QLatin1Char('\'')) || d->selectedWord.startsWith(QLatin1Char('\"'))) {
419 if (d->selectedWord.endsWith(QLatin1Char('\'')) || d->selectedWord.endsWith(QLatin1Char('\"'))) {
423 wordSelectCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, d->selectedWord.size());
429 if ((mousePosition < wordSelectCursor.selectionStart() || mousePosition >= wordSelectCursor.selectionEnd()) //
434 wordSelectCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, d->selectedWord.size());
436 d->wordIsMisspelled = isMouseCursorInsideWord && !d->selectedWord.isEmpty() && d->spellchecker->isMisspelled(d->selectedWord);
529 wordSelectCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, d->selectedWord.size());
670 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
671 || 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
673 && (k->key() == Qt::Key_A || k->key() == Qt::Key_B || k->key() == Qt::Key_E || k->key() == Qt::Key_N
bool addToSession(const QString &word)
Adds word to the words recognizable in the current session.
Definition speller.cpp:136
QStringList suggest(const QString &word) const
Fetches suggestions for the word.
Definition speller.cpp:104
bool addToPersonal(const QString &word)
Adds word to the list of of personal words.
Definition speller.cpp:128
void setLanguage(const QString &lang)
Sets the language supported by this speller.
Definition speller.cpp:243
The Sonnet Highlighter class, used for drawing red lines in text fields when detecting spelling mista...
Definition spellcheckhighlighter.h:54
bool wordIsMisspelled
This property holds whether the current word under the mouse is misspelled.
Definition spellcheckhighlighter.h:75
Q_INVOKABLE void ignoreWord(const QString &word)
Ignores the given word.
Definition spellcheckhighlighter.cpp:501
int selectionStart
This property holds the start of the selection.
Definition spellcheckhighlighter.h:67
void setCurrentLanguage(const QString &language)
Set language to use for spell checking.
Definition spellcheckhighlighter.cpp:463
QString currentLanguage
This property holds the current language used for spell checking.
Definition spellcheckhighlighter.h:87
QString wordUnderMouse
This property holds the current word under the mouse.
Definition spellcheckhighlighter.h:79
QML_ELEMENTQQuickTextDocument * document
This property holds the underneath document from a QML TextEdit.
Definition spellcheckhighlighter.h:59
void setDocument(QTextDocument *document)
Set a new QTextDocument for this highlighter to operate on.
Definition spellcheckhighlighter.cpp:555
Q_INVOKABLE void replaceWord(const QString &word, int at=-1)
Replace word at the current cursor position, or.
Definition spellcheckhighlighter.cpp:507
int cursorPosition
This property holds the current cursor position.
Definition spellcheckhighlighter.h:63
bool autoDetectLanguageDisabled
This property holds whether the automatic language detection is disabled overriding the Sonnet global...
Definition spellcheckhighlighter.h:114
bool active
This property holds whether spell checking is enabled.
Definition spellcheckhighlighter.h:104
Q_INVOKABLE QStringList suggestions(int position, int max=5)
Returns a list of suggested replacements for the given misspelled word.
Definition spellcheckhighlighter.cpp:390
void slotAutoDetection()
Run auto detection, disabling spell checking if too many errors are found.
Definition spellcheckhighlighter.cpp:232
Q_INVOKABLE bool isWordMisspelled(const QString &word)
Checks if a given word is marked as misspelled by the highlighter.
Definition spellcheckhighlighter.cpp:657
bool automatic
This property holds whether spell checking is automatically disabled if there's too many errors.
Definition spellcheckhighlighter.h:109
bool spellCheckerFound
This property holds whether a spell checking backend with support for the currentLanguage was found.
Definition spellcheckhighlighter.h:92
Q_INVOKABLE void addWordToDictionary(const QString &word)
Adds the given word permanently to the dictionary.
Definition spellcheckhighlighter.cpp:495
Q_SCRIPTABLE Q_NOREPLY void start()
bool isSpace(char32_t ucs4)
bool isValid() const const
void setAlphaF(float alpha)
KeyPress
Type type() const const
int key() const const
Qt::KeyboardModifiers modifiers() const const
qsizetype count() const const
QList< T > mid(qsizetype pos, qsizetype length) const const
bool contains(const Key &key) const const
T value(const Key &key, const T &defaultValue) const const
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
QString tr(const char *sourceText, const char *disambiguation, int n)
const QChar at(qsizetype position) const const
void clear()
bool isEmpty() const const
qsizetype length() const const
QTextBlockUserData * currentBlockUserData() const const
void rehighlight()
void setCurrentBlockState(int newState)
void setCurrentBlockUserData(QTextBlockUserData *data)
void setDocument(QTextDocument *doc)
void setFormat(int start, int count, const QColor &color)
red
Key_Enter
ControlModifier
bool isValid() const const
QTextBlock next() const const
int position() const const
QTextBlockUserData * userData() const const
SingleUnderline
void setUnderlineColor(const QColor &color)
void setUnderlineStyle(UnderlineStyle style)
MoveAnchor
NextCharacter
WordUnderCursor
QTextBlock block() const const
void clearSelection()
bool hasSelection() const const
void insertText(const QString &text)
bool movePosition(MoveOperation operation, MoveMode mode, int n)
int position() const const
int positionInBlock() const const
void select(SelectionType selection)
QString selectedText() const const
int selectionEnd() const const
int selectionStart() const const
void setPosition(int pos, MoveMode m)
void contentsChange(int position, int charsRemoved, int charsAdded)
void setBackground(const QBrush &brush)
void setForeground(const QBrush &brush)
void setInterval(int msec)
void setSingleShot(bool singleShot)
void start()
void timeout()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:10:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.