Logo Search packages:      
Sourcecode: cantor version File versions  Download package

Public Types | Public Member Functions | Protected Member Functions | Private Slots | Private Attributes

Cantor::DefaultHighlighter Class Reference

#include <defaulthighlighter.h>

Inheritance diagram for Cantor::DefaultHighlighter:
Inheritance graph
Collaboration diagram for Cantor::DefaultHighlighter:
Collaboration graph

List of all members.

Public Types

enum  { BlockTypeProperty = QTextFormat::UserProperty +25 }
enum  BlockType {
  UnknownBlock = 0, ErrorBlock = 1, ResultBlock = 2, CommandBlock = 3,
  NoHighlightBlock = 4

Public Member Functions

 DefaultHighlighter (QTextEdit *parent)

Protected Member Functions

template<class Container >
void addFunctions (const Container &functions)
template<class Container >
void addKeywords (const Container &keywords)
void addPair (const QChar &openSymbol, const QChar &closeSymbol)
void addRule (const QRegExp &regexp, const QTextCharFormat &format)
void addRule (const QString &word, const QTextCharFormat &format)
template<class Container >
void addRules (const Container &conditions, const QTextCharFormat &format)
template<class Container >
void addVariables (const Container &variables)
QTextCharFormat commentFormat () const
BlockType currentBlockType ()
QTextCharFormat errorFormat () const
QTextCharFormat functionFormat () const
virtual void highlightBlock (const QString &text)
void highlightPairs (const QString &text)
void highlightRegExps (const QString &text)
void highlightWords (const QString &text)
QTextCharFormat keywordFormat () const
QTextCharFormat matchingPairFormat () const
QTextCharFormat numberFormat () const
QTextCharFormat objectFormat () const
QTextCharFormat operatorFormat () const
void removeRule (const QRegExp &regexp)
void removeRule (const QString &word)
template<class Container >
void removeRules (const Container &conditions)
bool skipHighlighting (const QString &text)
QTextCharFormat stringFormat () const
QTextCharFormat variableFormat () const

Private Slots

void positionChanged ()
void updateFormats ()

Private Attributes


Detailed Description

The DefaultHighlighter is an implementation QSyntaxHighlighter. It covers most common cases of syntax highlighting for Cantor's command entries.

When creating a custom highlighter, for example for a new backend, you should use the provided functions addPairs(), addRule() and/or addRules().

If you need more specific functionality, subclass highlightBlock(). Usually it's a good idea to also call DefaultHighlighter's implementation from it.

Alexander Rieder

Definition at line 45 of file defaulthighlighter.h.

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index