Workspace 6.21.5
Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
HighlightingTextEdit Class Reference

#include <Tools/Widgets/highlightingtextedit.h>

Inheritance diagram for HighlightingTextEdit:
[legend]

Public Slots

virtual void tempHighlightBlock (int blockNumber)
 
virtual void tempHighlightCurrentBlock ()
 

Signals

void columnNumberChanged (int columnNumber)
 
void lineTempHighlighted (int blockNumber)
 

Public Member Functions

 HighlightingTextEdit (const QString &text, QBrush highlightBrush, bool readOnlyEditor=true, QWidget *parent=nullptr)
 
 HighlightingTextEdit (const QString &text, QColor highlightColor, bool readOnlyEditor=true, QWidget *parent=nullptr)
 
virtual void clearHighlights ()
 
void highlightBlock (const int blockNumber, bool moveCursor=true)
 
void highlightBlockFragment (const int blockNumber, int start, int count, bool isInline, bool moveCursor=true)
 
void highlightFromBlock (const int blockNumber, bool moveCursor=true)
 
virtual void highlightInsertionPoint (const int blockNumber, int column, bool moveCursor=true)
 
virtual void lineNumberAreaPaintEvent (QPaintEvent *event)
 
int lineNumberAreaWidth ()
 
void paintEvent (QPaintEvent *event) override
 
QTextCharFormat selectedLineFormat ()
 
void setAlternativeHighlightBrush (const QBrush &brush)
 
void setBackgroundColor (const QColor &colour)
 
void setBackgroundHighlight (const QBrush &brush)
 
void setBackgroundHighlight (const QColor &colour)
 
bool setDocumentCursor (const int blockNumber)
 
void setForegroundHighlight (const QBrush &brush)
 
void setForegroundHighlight (const QColor &colour)
 
virtual void updateExtraSelections ()
 

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *event) override
 
void init (bool readOnly)
 
virtual QString lineNumberStr (int blockNumber)
 
void resizeEvent (QResizeEvent *event) override
 

Protected Attributes

TextHighlighter highlighter_
 
QTextEdit::ExtraSelection lineMatchSelection_
 
QWidget * lineNumberArea_
 
bool readOnlyEditor_ {true}
 
int selectedBlockNumber_ {-1}
 
QTextCharFormat selectedLineFormat_
 
int selectionScrollPosition_ {-1}
 

Detailed Description

Adds single line or end block highlighting to a block of text

Constructor & Destructor Documentation

◆ HighlightingTextEdit() [1/2]

HighlightingTextEdit ( const QString &  text,
QColor  highlightColor,
bool  readOnlyEditor = true,
QWidget *  parent = nullptr 
)

◆ HighlightingTextEdit() [2/2]

HighlightingTextEdit ( const QString &  text,
QBrush  highlightBrush,
bool  readOnlyEditor = true,
QWidget *  parent = nullptr 
)

Member Function Documentation

◆ clearHighlights()

virtual void clearHighlights ( )
inlinevirtual

Reimplemented in HighlightingGhostTextEdit.

◆ columnNumberChanged

void columnNumberChanged ( int  columnNumber)
signal

◆ contextMenuEvent()

void contextMenuEvent ( QContextMenuEvent *  event)
overrideprotected

◆ highlightBlock()

void highlightBlock ( const int  blockNumber,
bool  moveCursor = true 
)

Highlights one line in the text, scrolls to show that line

◆ highlightBlockFragment()

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

◆ highlightFromBlock()

void highlightFromBlock ( const int  blockNumber,
bool  moveCursor = true 
)

Highlights every line from lineNumber onwards. Scrolls to blockNumber

◆ highlightInsertionPoint()

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

Reimplemented in HighlightingGhostTextEdit.

◆ init()

void init ( bool  readOnly)
protected

◆ lineNumberAreaPaintEvent()

void lineNumberAreaPaintEvent ( QPaintEvent *  event)
virtual

Reimplemented in HighlightingGhostTextEdit.

◆ lineNumberAreaWidth()

int lineNumberAreaWidth ( )

◆ lineNumberStr()

QString lineNumberStr ( int  blockNumber)
protectedvirtual

◆ lineTempHighlighted

void lineTempHighlighted ( int  blockNumber)
signal

◆ paintEvent()

void paintEvent ( QPaintEvent *  event)
override

◆ resizeEvent()

void resizeEvent ( QResizeEvent *  event)
overrideprotected

◆ selectedLineFormat()

QTextCharFormat selectedLineFormat ( )
inline

◆ setAlternativeHighlightBrush()

void setAlternativeHighlightBrush ( const QBrush &  brush)
inline

◆ setBackgroundColor()

void setBackgroundColor ( const QColor &  colour)

◆ setBackgroundHighlight() [1/2]

void setBackgroundHighlight ( const QBrush &  brush)
inline

◆ setBackgroundHighlight() [2/2]

void setBackgroundHighlight ( const QColor &  colour)
inline

◆ setDocumentCursor()

bool setDocumentCursor ( const int  blockNumber)

◆ setForegroundHighlight() [1/2]

void setForegroundHighlight ( const QBrush &  brush)
inline

◆ setForegroundHighlight() [2/2]

void setForegroundHighlight ( const QColor &  colour)
inline

◆ tempHighlightBlock

void tempHighlightBlock ( int  blockNumber)
virtualslot

◆ tempHighlightCurrentBlock

void tempHighlightCurrentBlock ( )
virtualslot

◆ updateExtraSelections()

void updateExtraSelections ( )
virtual

Member Data Documentation

◆ highlighter_

TextHighlighter highlighter_
protected

◆ lineMatchSelection_

QTextEdit::ExtraSelection lineMatchSelection_
protected

◆ lineNumberArea_

QWidget* lineNumberArea_
protected

◆ readOnlyEditor_

bool readOnlyEditor_ {true}
protected

◆ selectedBlockNumber_

int selectedBlockNumber_ {-1}
protected

◆ selectedLineFormat_

QTextCharFormat selectedLineFormat_
protected

◆ selectionScrollPosition_

int selectionScrollPosition_ {-1}
protected