Sonnet::BackgroundChecker

Search for usage in LXR

#include <Sonnet/BackgroundChecker>

Inheritance diagram for Sonnet::BackgroundChecker:

Signals

void done ()
 
void misspelling (const QString &word, int start)
 

Public Slots

void changeLanguage (const QString &lang)
 
virtual void continueChecking ()
 
void replace (int start, const QString &oldText, const QString &newText)
 
virtual void start ()
 
virtual void stop ()
 

Public Member Functions

 BackgroundChecker (const Speller &speller, QObject *parent=nullptr)
 
 BackgroundChecker (QObject *parent=nullptr)
 
bool addWordToPersonal (const QString &word)
 
bool addWordToSession (const QString &word)
 
bool autoDetectLanguageDisabled () const
 
bool checkWord (const QString &word)
 
QString currentContext () const
 
void setAutoDetectLanguageDisabled (bool autoDetectDisabled)
 
void setSpeller (const Speller &speller)
 
void setText (const QString &text)
 
Speller speller () const
 
QStringList suggest (const QString &word) const
 
QString text () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Protected Slots

void slotEngineDone ()
 

Protected Member Functions

virtual QString fetchMoreText ()
 
virtual void finishedCurrentFeed ()
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 

Detailed Description

class used for spell checking in the background

BackgroundChecker is used to perform spell checking without blocking the application. You can use it as is by calling the checkText function or subclass it and reimplement getMoreText function.

The misspelling signal is emitted whenever a misspelled word is found. The background checker stops right before emitting the signal. So the parent has to call continueChecking function to resume the checking.

done signal is emitted when whole text is spell checked.

Author
Zack Rusin zack@.nosp@m.kde..nosp@m.org

Definition at line 43 of file backgroundchecker.h.

Member Function Documentation

◆ addWordToSession()

bool BackgroundChecker::addWordToSession ( const QString word)

This method is used to add a word to the session of the speller currently set in BackgroundChecker.

Since
5.55

Definition at line 148 of file backgroundchecker.cpp.

◆ autoDetectLanguageDisabled()

bool BackgroundChecker::autoDetectLanguageDisabled ( ) const

Returns whether the automatic language detection is disabled, overriding the Sonnet settings.

Returns
true if the automatic language detection is disabled
Since
5.71

Definition at line 118 of file backgroundchecker.cpp.

◆ continueChecking

void BackgroundChecker::continueChecking ( )
virtualslot

After emitting misspelling signal the background checker stops.

The catcher is responsible for calling continueChecking function to resume checking.

Definition at line 164 of file backgroundchecker.cpp.

◆ done

void Sonnet::BackgroundChecker::done ( )
signal

Emitted after the whole text has been spell checked.

◆ fetchMoreText()

QString BackgroundChecker::fetchMoreText ( )
protectedvirtual

This function is called to get the text to spell check.

It will be called continuesly until it returns QString() in which case the done() signal is emitted. Note: the start parameter in misspelling() is not a combined position but a position in the last string returned by fetchMoreText. You need to store the state in the derivatives.

Definition at line 109 of file backgroundchecker.cpp.

◆ finishedCurrentFeed()

void BackgroundChecker::finishedCurrentFeed ( )
protectedvirtual

This function will be called whenever the background checker will be finished text which it got from fetchMoreText.

Definition at line 114 of file backgroundchecker.cpp.

◆ misspelling

void Sonnet::BackgroundChecker::misspelling ( const QString word,
int  start 
)
signal

Emitted whenever a misspelled word is found.

◆ setAutoDetectLanguageDisabled()

void BackgroundChecker::setAutoDetectLanguageDisabled ( bool  autoDetectDisabled)

Sets whether to disable the automatic language detection.

Parameters
autoDetectDisabledif true, the language will not be detected automatically by the spell checker, even if the option is enabled in the Sonnet settings.
Since
5.71

Definition at line 123 of file backgroundchecker.cpp.

◆ setText()

void BackgroundChecker::setText ( const QString text)

This method is used to spell check static text.

It automatically invokes start().

Use fetchMoreText() with start() to spell check a stream.

Definition at line 89 of file backgroundchecker.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Nov 30 2023 03:58:27 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.