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)
 
QBindable< QStringbindableObjectName ()
 
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 () const const
 
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 QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isQuickItemType () const const
 
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_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_GADGET_EXPORT (EXPORT_MACRO)
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_MOC_INCLUDE Q_MOC_INCLUDE
 
 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
 
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 setObjectName (QAnyStringView name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool setProperty (const char *name, QVariant &&value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds interval, 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

- Public Types inherited from QObject
typedef  QObjectList
 
- 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)
 

Detailed Description

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

class used for spell checking in the background

Constructor & Destructor Documentation

◆ BackgroundChecker() [1/2]

BackgroundChecker::BackgroundChecker ( QObject * parent = nullptr)
explicit

Definition at line 67 of file backgroundchecker.cpp.

◆ BackgroundChecker() [2/2]

BackgroundChecker::BackgroundChecker ( const Speller & speller,
QObject * parent = nullptr )
explicit

Definition at line 75 of file backgroundchecker.cpp.

Member Function Documentation

◆ addWordToPersonal()

bool BackgroundChecker::addWordToPersonal ( const QString & word)

Definition at line 140 of file backgroundchecker.cpp.

◆ 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 145 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 115 of file backgroundchecker.cpp.

◆ changeLanguage

void BackgroundChecker::changeLanguage ( const QString & lang)
slot

Definition at line 155 of file backgroundchecker.cpp.

◆ checkWord()

bool BackgroundChecker::checkWord ( const QString & word)

Definition at line 135 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 161 of file backgroundchecker.cpp.

◆ currentContext()

QString BackgroundChecker::currentContext ( ) const

Definition at line 184 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 106 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 111 of file backgroundchecker.cpp.

◆ misspelling

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

Emitted whenever a misspelled word is found.

◆ replace

void Sonnet::BackgroundChecker::replace ( int start,
const QString & oldText,
const QString & newText )
slot

Definition at line 207 of file backgroundchecker.cpp.

◆ 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 120 of file backgroundchecker.cpp.

◆ setSpeller()

void BackgroundChecker::setSpeller ( const Speller & speller)

Definition at line 125 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 86 of file backgroundchecker.cpp.

◆ slotEngineDone

void BackgroundChecker::slotEngineDone ( )
protectedslot

Definition at line 166 of file backgroundchecker.cpp.

◆ speller()

Speller BackgroundChecker::speller ( ) const

Definition at line 130 of file backgroundchecker.cpp.

◆ start

void BackgroundChecker::start ( )
virtualslot

Definition at line 92 of file backgroundchecker.cpp.

◆ stop

void BackgroundChecker::stop ( )
virtualslot

Definition at line 101 of file backgroundchecker.cpp.

◆ suggest()

QStringList BackgroundChecker::suggest ( const QString & word) const

Definition at line 150 of file backgroundchecker.cpp.

◆ text()

QString BackgroundChecker::text ( ) const

Definition at line 179 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-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.