Base class for syntax highlighting. More...
#include <SyntaxHighlighter.h>
Inheritance diagram for camitk::SyntaxHighlighter:
Collaboration diagram for camitk::SyntaxHighlighter:Public Member Functions | |
| void | addRule (QString regexp, QColor color, int weight=QFont::Normal, bool italic=false, QColor backgroundColor=Qt::transparent) |
| add a new rule (can be done on the fly) | |
| bool | removeRule (QString regexp) |
| remove an existing rule (can be done on the fly) | |
| SyntaxHighlighter (QTextDocument *parent=nullptr) | |
| constructor | |
Base class for syntax highlighting.
Defines rules for transformation to facilitate new language highlighting.
In the inherited class' constructor, just add rules, and that's it!
You can now highlight any text edit:
| SyntaxHighlighter::SyntaxHighlighter | ( | QTextDocument * | parent = nullptr | ) |
constructor
| parent | (optional) if not given during instantiation, use setDocument(..) afterward |
| void SyntaxHighlighter::addRule | ( | QString | regexp, |
| QColor | color, | ||
| int | weight = QFont::Normal, |
||
| bool | italic = false, |
||
| QColor | backgroundColor = Qt::transparent |
||
| ) |
add a new rule (can be done on the fly)
| regexp | to match |
| color | text color |
| weight | QFont::Normal for normal (default) or QFont::Bold for bold |
| italic | false by default |
| backgroundColor | transparent by default |
Referenced by CMakeSyntaxHighlighter::CMakeSyntaxHighlighter(), CppSyntaxHighlighter::CppSyntaxHighlighter(), ExtensionBuilderLogSyntaxHighlighter::ExtensionBuilderLogSyntaxHighlighter(), JsonSyntaxHighlighter::JsonSyntaxHighlighter(), and camitk::LogSyntaxHighlighter::LogSyntaxHighlighter().
Here is the caller graph for this function:| bool SyntaxHighlighter::removeRule | ( | QString | regexp | ) |
remove an existing rule (can be done on the fly)