Warning, file /sdk/lokalize/src/syntaxhighlighter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 This file is part of Lokalize 0003 0004 SPDX-FileCopyrightText: 2007-2009 Nick Shaforostoff <shafff@ukr.net> 0005 SPDX-FileCopyrightText: 2018-2019 Simon Depiets <sdepiets@gmail.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0008 */ 0009 0010 #ifndef HIGHLIGHTER_H 0011 #define HIGHLIGHTER_H 0012 0013 #include <QSyntaxHighlighter> 0014 #include <sonnet/highlighter.h> 0015 #include <sonnet/speller.h> 0016 #include <kcolorscheme.h> 0017 0018 #include <QHash> 0019 #include <QTextCharFormat> 0020 0021 0022 class QTextEdit; 0023 0024 class SyntaxHighlighter : public Sonnet::Highlighter 0025 { 0026 Q_OBJECT 0027 0028 public: 0029 explicit SyntaxHighlighter(QTextEdit *parent); 0030 ~SyntaxHighlighter() override = default; 0031 0032 void setApprovementState(bool a) 0033 { 0034 m_approved = a; 0035 } 0036 void setSourceString(const QString& s) 0037 { 0038 m_sourceString = s; 0039 } 0040 0041 protected: 0042 void highlightBlock(const QString &text) override; 0043 0044 void setMisspelled(int start, int count) override; 0045 void unsetMisspelled(int start, int count) override; 0046 0047 private Q_SLOTS: 0048 void settingsChanged(); 0049 0050 // void setFormatRetainingUnderlines(int start, int count, QTextCharFormat format); 0051 private: 0052 struct HighlightingRule { 0053 QRegExp pattern; 0054 QTextCharFormat format; 0055 }; 0056 QVector<HighlightingRule> highlightingRules; 0057 0058 // bool fromDocbook; 0059 QTextCharFormat tagFormat; 0060 KStatefulBrush tagBrush; 0061 bool m_approved; 0062 QString m_sourceString; 0063 }; 0064 0065 #endif