Class Avogadro::QtGui::GenericHighlighter#

class GenericHighlighter : public QSyntaxHighlighter#

The GenericHighlighter class provides a regexp-based programmable syntax highlighter.

Public Functions

explicit GenericHighlighter(QObject *parent_ = nullptr)#

Construct a highlighter with an empty rule set.

~GenericHighlighter() override#
GenericHighlighter(const GenericHighlighter &other)#

Construct a new highlighter using the rule set of other.

GenericHighlighter &operator=(GenericHighlighter other)#

Replace this highlighter’s rule set with that of other.

GenericHighlighter &operator+=(const GenericHighlighter &other)#

Concatenate other’s rule set with this highlighter’s rule set.

Rule &addRule()#

Add a new rule to this highlighter, returning a reference to the new rule.

int ruleCount() const#

The number of rules in this highlighter.

Rule &rule(int idx)#

A reference to the rule at the specified zero-based index.

const Rule &rule(int idx) const#

A reference to the rule at the specified zero-based index.

QList<Rule> rules() const#

An ordered list of this highlighter’s rules.

Protected Functions

void highlightBlock(const QString &text) override#


inline friend void swap(GenericHighlighter &first, GenericHighlighter &second)#
class Rule#

The Rule class stores a syntax highlighting rule as a set of QRegExp patterns and a text format.

Public Functions

inline Rule()#
inline ~Rule()#
void addPattern(const QRegExp &regexp)#

Add the pattern regexp to this Rule.

void setFormat(const QTextCharFormat &format)#

Set this Rule’s text format.

void apply(const QString &text, GenericHighlighter &highlighter)#

Apply this rule to the string of text, updating the highlighter if any matches are found.