File indexing completed on 2024-12-22 04:40:10
0001 /* 0002 SPDX-FileCopyrightText: 2022 Mladen Milinkovic <max@smoothware.net> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef CSSHIGHLIGHTER_H 0008 #define CSSHIGHLIGHTER_H 0009 0010 #include <QColor> 0011 #include <QSyntaxHighlighter> 0012 #include <QTextCharFormat> 0013 0014 QT_FORWARD_DECLARE_CLASS(QTextDocument); 0015 0016 namespace SubtitleComposer { 0017 0018 class CSSHighlighter : public QSyntaxHighlighter 0019 { 0020 Q_OBJECT 0021 0022 public: 0023 CSSHighlighter(QTextDocument *parent = 0); 0024 0025 bool event(QEvent *ev) override; 0026 0027 protected: 0028 void highlightBlock(const QString &text) override; 0029 0030 private: 0031 void onPaletteChanged(); 0032 0033 private: 0034 QTextCharFormat m_commentFormat; 0035 QTextCharFormat m_attributeFormat; 0036 QTextCharFormat m_styleFormat; 0037 QTextCharFormat m_stringFormat; 0038 QTextCharFormat m_valueFormat; 0039 }; 0040 0041 } 0042 #endif // CSSHIGHLIGHTER_H