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