Workspace 6.21.5
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TextHighlighter Class Reference

#include <Tools/Widgets/highlightingtextedit.h>

Inherits QSyntaxHighlighter.

Public Member Functions

 TextHighlighter (QTextDocument *parent, const QBrush &highlightBrush)
 
 TextHighlighter (QTextDocument *parent, const QColor &highlightColor)
 
QBrush alternativeHighlightBrush ()
 
virtual void clearHighlights ()
 
virtual void highlightBlock (const int blockNumber, bool highlight=true)
 
virtual void highlightBlock (const QString &text) override
 
void highlightBlockFragment (const int blockNumber, int start, int count, bool isInline)
 
QColor highlightedTextColor ()
 
void highlightFromBlock (const int blockNumber)
 
void highlightInsertionPoint (const int blockNumber, int column, bool moveCursor=true)
 
QColor selectionColor ()
 
void setAlternativeHighlightBrush (const QBrush &highlightBrush)
 
void setBackgroundHighlight (const QBrush &brush)
 
void setBackgroundHighlight (const QColor &colour)
 
void setForegroundHighlight (const QBrush &brush)
 
void setForegroundHighlight (const QColor &colour)
 

Protected Member Functions

void init (const QColor &highlightColor)
 

Protected Attributes

int blockNumber_
 
QTextCharFormat highlightedLineFormat_
 
QTextCharFormat highlightedTextFormat_
 
QTextCharFormat highlightedTextOverLineBreakFormat_
 
int highlightStartBlock_
 

Detailed Description

Simple highlighter for one or more lines of text

Constructor & Destructor Documentation

◆ TextHighlighter() [1/2]

TextHighlighter ( QTextDocument *  parent,
const QColor &  highlightColor 
)

◆ TextHighlighter() [2/2]

TextHighlighter ( QTextDocument *  parent,
const QBrush &  highlightBrush 
)

Member Function Documentation

◆ alternativeHighlightBrush()

QBrush alternativeHighlightBrush ( )
inline

◆ clearHighlights()

void clearHighlights ( )
virtual

◆ highlightBlock() [1/2]

void highlightBlock ( const int  blockNumber,
bool  highlight = true 
)
virtual

Adds or removes highlight from a line

Parameters
blockNumberLine to highlight or remove from highlighting
highlightFalse to remove highlighting

◆ highlightBlock() [2/2]

void highlightBlock ( const QString &  text)
overridevirtual

◆ highlightBlockFragment()

void highlightBlockFragment ( const int  blockNumber,
int  start,
int  count,
bool  isInline 
)

◆ highlightedTextColor()

QColor highlightedTextColor ( )
inline

◆ highlightFromBlock()

void highlightFromBlock ( const int  blockNumber)

Highlights every line from the given line to the end of the text. Removes existing highlighting

Parameters
blockNumberFirst line of highlighted block

◆ highlightInsertionPoint()

void highlightInsertionPoint ( const int  blockNumber,
int  column,
bool  moveCursor = true 
)

◆ init()

void init ( const QColor &  highlightColor)
protected

◆ selectionColor()

QColor selectionColor ( )

◆ setAlternativeHighlightBrush()

void setAlternativeHighlightBrush ( const QBrush &  highlightBrush)

◆ setBackgroundHighlight() [1/2]

void setBackgroundHighlight ( const QBrush &  brush)
inline

◆ setBackgroundHighlight() [2/2]

void setBackgroundHighlight ( const QColor &  colour)
inline

◆ setForegroundHighlight() [1/2]

void setForegroundHighlight ( const QBrush &  brush)
inline

◆ setForegroundHighlight() [2/2]

void setForegroundHighlight ( const QColor &  colour)
inline

Member Data Documentation

◆ blockNumber_

int blockNumber_
protected

◆ highlightedLineFormat_

QTextCharFormat highlightedLineFormat_
protected

◆ highlightedTextFormat_

QTextCharFormat highlightedTextFormat_
protected

◆ highlightedTextOverLineBreakFormat_

QTextCharFormat highlightedTextOverLineBreakFormat_
protected

◆ highlightStartBlock_

int highlightStartBlock_
protected