Extending Qt Creator Manual | SyntaxHighlighter

Extending Qt Creator Manual 4.3.0

# SyntaxHighlighter Class

(TextEditor::SyntaxHighlighter)

Inherited By: | VcsBase::BaseAnnotationHighlighter and VcsBase::DiffAndLogHighlighter

- List of all members, including inherited members

## Public Functions

| SyntaxHighlighter(QObject *parent = 0)
| SyntaxHighlighter(QTextDocument *parent)
| SyntaxHighlighter(QTextEdit *parent)
virtual | ~SyntaxHighlighter()
QTextDocument * | document() const
void | setDocument(QTextDocument *doc)
void | setExtraFormats(const QTextBlock &block, QVector<QTextLayout::FormatRange> &formats)
virtual void | setFontSettings(const TextEditor::FontSettings &fontSettings)

## Public Slots

void | rehighlight()
void | rehighlightBlock(const QTextBlock &block)

## Static Public Members

QList<QColor> | generateColors(int n, const QColor &background)

## Protected Functions

void | applyFormatToSpaces(const QString &text, const QTextCharFormat &format)
QTextBlock | currentBlock() const
int | currentBlockState() const
QTextBlockUserData * | currentBlockUserData() const
QTextCharFormat | format(int pos) const
QTextCharFormat | formatForCategory(int categoryIndex) const
virtual void | highlightBlock(const QString &text) = 0
int | previousBlockState() const
void | setCurrentBlockState(int newState)
void | setCurrentBlockUserData(QTextBlockUserData *data)
void | setFormat(int start, int count, const QTextCharFormat &format)
void | setFormat(int start, int count, const QColor &color)
void | setFormat(int start, int count, const QFont &font)
void | setTextFormatCategories(const QVector<TextEditor::TextStyle> &categories)

## Member Function Documentation

### SyntaxHighlighter::SyntaxHighlighter(QObject *parent = 0)

Default constructs an instance of SyntaxHighlighter.

### SyntaxHighlighter::SyntaxHighlighter(QTextDocument *parent)

Default constructs an instance of SyntaxHighlighter.

### SyntaxHighlighter::SyntaxHighlighter(QTextEdit *parent)

Default constructs an instance of SyntaxHighlighter.

### `[virtual]` SyntaxHighlighter::~SyntaxHighlighter()

Destroys the instance of SyntaxHighlighter. The destructor is virtual.

### `[protected]` void SyntaxHighlighter::applyFormatToSpaces(const QString &text, const QTextCharFormat &format)

### `[protected]` QTextBlock SyntaxHighlighter::currentBlock() const

### `[protected]` int SyntaxHighlighter::currentBlockState() const

See also setCurrentBlockState().

### `[protected]` QTextBlockUserData *SyntaxHighlighter::currentBlockUserData() const

See also setCurrentBlockUserData().

### QTextDocument *SyntaxHighlighter::document() const

See also setDocument().

### `[protected]` QTextCharFormat SyntaxHighlighter::format(int pos) const

See also setFormat().

### `[protected]` QTextCharFormat SyntaxHighlighter::formatForCategory(int categoryIndex) const

### `[static]` QList<QColor> SyntaxHighlighter::generateColors(int n, const QColor &background)

### `[pure virtual protected]` void SyntaxHighlighter::highlightBlock(const QString &text)

### `[protected]` int SyntaxHighlighter::previousBlockState() const

### `[slot]` void SyntaxHighlighter::rehighlight()

### `[slot]` void SyntaxHighlighter::rehighlightBlock(const QTextBlock &block)

### `[protected]` void SyntaxHighlighter::setCurrentBlockState(int newState)

See also currentBlockState().

### `[protected]` void SyntaxHighlighter::setCurrentBlockUserData(QTextBlockUserData *data)

See also currentBlockUserData().

### void SyntaxHighlighter::setDocument(QTextDocument *doc)

See also document().

### void SyntaxHighlighter::setExtraFormats(const QTextBlock &block, QVector<QTextLayout::FormatRange> &formats)

### `[virtual]` void SyntaxHighlighter::setFontSettings(const TextEditor::FontSettings &fontSettings)

### `[protected]` void SyntaxHighlighter::setFormat(int start, int count, const QTextCharFormat &format)

See also format().

### `[protected]` void SyntaxHighlighter::setFormat(int start, int count, const QColor &color)

### `[protected]` void SyntaxHighlighter::setFormat(int start, int count, const QFont &font)

### `[protected]` void SyntaxHighlighter::setTextFormatCategories(const QVector<TextEditor::TextStyle> &categories)