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

Highlights text in a QTextDocument.

#include <Workspace/Presentation/Logging/highlighting.h>

Inherits QSyntaxHighlighter.

Public Slots

void setEnabled (bool enabled)
 

Signals

void modified ()
 

Public Member Functions

 Highlighting (TextManipulation &textManip)
 
void add (const Highlighter &highlighter)
 
bool enabled () const
 
QTextCharFormat & getDefaultFormat ()
 
HighlightergetHighlighter (int index)
 
unsigned getNumHighlighters () const
 
TextManipulationgetTextManipulation ()
 
void remove (int index)
 
void setupContextMenu (QMenu *menu)
 Sets the menu to use to provide access to the user for changing highlighting options.
 
void swapHighlighters (int index1, int index2)
 

Protected Member Functions

void highlightBlock (const QString &text) override
 

Constructor & Destructor Documentation

◆ Highlighting()

Highlighting ( TextManipulation textManip)

Member Function Documentation

◆ add()

void add ( const Highlighter highlighter)
Parameters
highlighterThe highlighter to add.

This function takes a copy of highlighter and adds it to the list held internally.

◆ enabled()

bool enabled ( ) const
Returns
True if highlighting is enabled.
See also
setEnabled()

◆ getDefaultFormat()

QTextCharFormat & getDefaultFormat ( )
Returns
The default format from the TextManipulation object with which the highlighting is associated.

◆ getHighlighter()

Highlighter & getHighlighter ( int  index)
Parameters
indexThe index of the highlighter to retrieve. It must refer to a valid index (no check is performed).
Returns
The highlighter at the specified index. If any changes are made to the highlighter,

◆ getNumHighlighters()

unsigned getNumHighlighters ( ) const
Returns
The number of highlighters currently defined.

◆ getTextManipulation()

TextManipulation & getTextManipulation ( )
Returns
The TextManipulation object the highlighters will act on.

◆ highlightBlock()

void highlightBlock ( const QString &  text)
overrideprotected
Parameters
textContains the text the highlighter may have to highlight.

highlightBlock() is called any time a contentsDirty() signal is sent from the document it is currently associated with. It will iterate through its list of individual Highlighter objects and apply them to the text if that highlighter is enabled. If this Highlighting object is itself disabled, then highlightBlock() will apply no highlighting.

◆ modified

void modified ( )
signal

◆ remove()

void remove ( int  index)

◆ setEnabled

void setEnabled ( bool  enabled)
slot
Parameters
enabledThe desired Highlighting state (on or off).

If enabled, syntax highlighting will be applied to the document according to the currently defined set of highlighting rules. Rules can be disabled individually, but the function here is a global control which can be used to disable all highlighting without disturbing the individual enabled states of each highlighter.

See also
getEnabled()

◆ setupContextMenu()

void setupContextMenu ( QMenu *  menu)
Parameters
menuis the menu to use to provide highlighting options to the user

◆ swapHighlighters()

void swapHighlighters ( int  index1,
int  index2 
)