KDE 5.0 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

Highlighter Class Reference

from PyKDE5.sonnet import *

Inherits: QSyntaxHighlighter → QObject
Namespace: Sonnet

Detailed Description


Signals

 activeChanged (QString description)

Methods

 __init__ (self, QTextEdit textEdit, QColor col=QColor())
 addWordToDictionary (self, QString word)
bool automatic (self)
bool checkerEnabledByDefault (self)
QString currentLanguage (self)
bool eventFilter (self, QObject o, QEvent e)
 highlightBlock (self, QString text)
 ignoreWord (self, QString word)
bool intraWordEditing (self)
bool isActive (self)
bool isWordMisspelled (self, QString word)
 setActive (self, bool active)
 setAutomatic (self, bool automatic)
 setCurrentLanguage (self, QString language)
 setDocument (self, QTextDocument document)
 setIntraWordEditing (self, bool editing)
 setMisspelled (self, int start, int count)
 setMisspelledColor (self, QColor color)
 slotAutoDetection (self)
 slotRehighlight (self)
bool spellCheckerFound (self)
QStringList suggestionsForWord (self, QString word, int max=10)
 unsetMisspelled (self, int start, int count)

Signal Documentation

activeChanged ( QString  description
)

Emitted when as-you-type spell checking is enabled or disabled.

Parameters:
description  is a i18n description of the new state, with an optional reason

Signal syntax:
QObject.connect(source, SIGNAL("activeChanged(const QString&)"), target_slot)

Method Documentation

__init__ (  self,
QTextEdit  textEdit,
QColor  col=QColor()
)
addWordToDictionary (  self,
QString  word
)

Adds the given word permanently to the dictionary. It will never be marked as misspelled again, even after restarting the application.

Parameters:
word  the word which will be added to the dictionary

Since:
4.1

bool automatic (   self )

Returns the state of the automatic disabling of spell checking.

Returns:
true if spell checking is automatically disabled if there's too many errors

bool checkerEnabledByDefault (   self )

Return true if checker is enabled by default

Since:
4.5

QString currentLanguage (   self )

Returns the current language used for spell checking.

Returns:
the language code for the current language.

bool eventFilter (  self,
QObject  o,
QEvent  e
)
highlightBlock (  self,
QString  text
)
ignoreWord (  self,
QString  word
)

Ignores the given word. This word will not be marked misspelled for this session. It will again be marked as misspelled when creating new highlighters.

Parameters:
word  the word which will be ignored

Since:
4.1

bool intraWordEditing (   self )
bool isActive (   self )

Returns the state of spell checking.

Returns:
true if spell checking is active

See also:
setActive()

bool isWordMisspelled (  self,
QString  word
)

Checks if a given word is marked as misspelled by the highlighter.

Parameters:
word  the word to be checked

Returns:
true if the given word is misspelled.
Since:
4.1

setActive (  self,
bool  active
)

Enable/Disable spell checking.

If active is true then spell checking is enabled; otherwise it is disabled. Note that you have to disable automatic (de)activation with setAutomatic() before you change the state of spell checking if you want to persistently enable/disable spell checking.

Parameters:
active  if true, then spell checking is enabled

See also:
isActive(), setAutomatic()

setAutomatic (  self,
bool  automatic
)

Sets whether to automatically disable spell checking if there's too many errors.

Parameters:
automatic  if true, spell checking will be disabled if there's a significant amount of errors.

setCurrentLanguage (  self,
QString  language
)

Set language to use for spell checking. Warning: this disables automatic language detection

Parameters:
language  the language code for the new language to use.

setDocument (  self,
QTextDocument  document
)

Set a new QTextDocument for this highlighter to operate on.

Parameters:
document  the new document to operate on.

setIntraWordEditing (  self,
bool  editing
)
setMisspelled (  self,
int  start,
int  count
)
setMisspelledColor (  self,
QColor  color
)

Sets the color in which the highlighter underlines misspelled words.

Since:
4.2

slotAutoDetection (   self )

Run auto detection, disabling spell checking if too many errors are found.

slotRehighlight (   self )

Force a new highlighting.

bool spellCheckerFound (   self )

Returns whether a spell checking backend with support for the currentLanguage was found.

Returns:
true if spell checking is supported for the current language.

QStringList suggestionsForWord (  self,
QString  word,
int  max=10
)

Returns a list of suggested replacements for the given misspelled word. If the word is not misspelled, the list will be empty.

Parameters:
word  the misspelled word
max  at most this many suggestions will be returned. If this is -1, as many suggestions as the spell backend supports will be returned.

Returns:
a list of suggested replacements for the word
Since:
4.1

unsetMisspelled (  self,
int  start,
int  count
)
  • Full Index

Modules

  • karchive
  • kcoreaddons
  • kguiaddons
  • kitemmodels
  • kitemviews
  • kplotting
  • kwidgetsaddons
  • solid
  • sonnet
This documentation is maintained by Simon Edwards.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal