1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#pragma once
// Qt
#include <QSyntaxHighlighter> // Required for inheritance
class QSyntaxStyle;
/**
* @brief Class, that descrubes highlighter with
* syntax style.
*/
class QStyleSyntaxHighlighter : public QSyntaxHighlighter
{
public:
/**
* @brief Constructor.
* @param document Pointer to text document.
*/
explicit QStyleSyntaxHighlighter(QTextDocument* document=nullptr);
// Disable copying
QStyleSyntaxHighlighter(const QStyleSyntaxHighlighter&) = delete;
QStyleSyntaxHighlighter& operator=(const QStyleSyntaxHighlighter&) = delete;
/**
* @brief Method for setting syntax style.
* @param style Pointer to syntax style.
*/
void setSyntaxStyle(QSyntaxStyle* style);
/**
* @brief Method for getting syntax style.
* @return Pointer to syntax style. May be nullptr.
*/
QSyntaxStyle* syntaxStyle() const;
private:
QSyntaxStyle* m_syntaxStyle;
};
|