add QCodeEditor

This commit is contained in:
Carl Philipp Klemm 2025-10-13 12:40:46 +02:00
parent bccee9bd36
commit 2f3069a388
316 changed files with 98016 additions and 0 deletions

View file

@ -0,0 +1,33 @@
#pragma once
// QCodeEditor
#include <QStyleSyntaxHighlighter> // Required for inheritance
#include <QHighlightRule>
// Qt
#include <QVector>
/**
* @brief Class, that describes JSON code
* highlighter.
*/
class QJSONHighlighter : public QStyleSyntaxHighlighter
{
Q_OBJECT
public:
/**
* @brief Constructor.
* @param document Pointer to document.
*/
explicit QJSONHighlighter(QTextDocument* document=nullptr);
protected:
void highlightBlock(const QString& text) override;
private:
QVector<QHighlightRule> m_highlightRules;
QRegularExpression m_keyRegex;
};