QScintilla 2.7.2

- Main Page
- Classes
- Directories

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
QsciLexerCustom Class Reference

`#include <qscilexercustom.h>`

Inherits QsciLexer.

List of all members.

## Public Member Functions

- QsciLexerCustom (QObject *parent=0)
- virtual ~QsciLexerCustom ()
- void setStyling (int length, int style)
- void setStyling (int length, const QsciStyle &style)
- void startStyling (int pos, int styleBits=0)
- virtual void styleText (int start, int end)=0
- virtual void setEditor (QsciScintilla *editor)
- virtual int styleBitsNeeded () const

## Detailed Description

The QsciLexerCustom class is an abstract class used as a base for new language lexers.

The advantage of implementing a new lexer this way (as opposed to adding the lexer to the underlying Scintilla code) is that it does not require the QScintilla library to be re-compiled. It also makes it possible to integrate external lexers.

All that is necessary to implement a new lexer is to define appropriate styles and to re-implement the styleText() method.

## Constructor & Destructor Documentation

QsciLexerCustom::QsciLexerCustom | ( | QObject * | parent = `0` | ) |

Construct a QsciLexerCustom with parent parent. parent is typically the QsciScintilla instance.

## Member Function Documentation

void QsciLexerCustom::setStyling | ( | int | length,
|  | int | style
| ) |  |

The next length characters starting from the current styling position have their style set to style number style. The current styling position is moved. The styling position is initially set by calling startStyling().

See also:
  startStyling(), styleText()

void QsciLexerCustom::setStyling | ( | int | length,
|  | const QsciStyle & | style
| ) |  |

The next length characters starting from the current styling position have their style set to style style. The current styling position is moved. The styling position is initially set by calling startStyling().

See also:
  startStyling(), styleText()

void QsciLexerCustom::startStyling | ( | int | pos,
|  | int | styleBits = `0`
| ) |  |

The styling position is set to start and the mask of style bits that can be set is set to styleBits. styleBits allows the styling of text to be done over several passes by setting different style bits on each pass. If styleBits is 0 then all style bits (as returned by styleBitsNeeded()) are set.

See also:
  setStyling(), styleBitsNeeded(), styleText()

virtual void QsciLexerCustom::styleText | ( | int | start,
|  | int | end
| ) |  | `[pure virtual]`

This is called when the section of text beginning at position start and up to position end needs to be styled. start will always be at the start of a line. The text is styled by calling startStyling() followed by one or more calls to setStyling(). It must be re-implemented by a sub-class.

See also:
  setStyling(), startStyling()

virtual int QsciLexerCustom::styleBitsNeeded | ( |  | ) | const`[virtual]`

This re-implementation returns 5 as the number of style bits needed.

Reimplemented from QsciLexer.