1/*
2 SPDX-FileCopyrightText: 2018 Eike Hein <hein@kde.org>
3 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
4
5 SPDX-License-Identifier: MIT
6*/
7
8#ifndef KQUICKSYNTAXHIGHLIGHTER_H
9#define KQUICKSYNTAXHIGHLIGHTER_H
10
11#include <KSyntaxHighlighting/Definition>
12#include <KSyntaxHighlighting/Theme>
13
14#include <QObject>
15#include <QVariant>
16
17namespace KSyntaxHighlighting
18{
19class Repository;
20class SyntaxHighlighter;
21}
22
23class KQuickSyntaxHighlighter : public QObject
24{
25 Q_OBJECT
26
27 Q_PROPERTY(QObject *textEdit READ textEdit WRITE setTextEdit NOTIFY textEditChanged)
28 Q_PROPERTY(QVariant definition READ definition WRITE setDefinition NOTIFY definitionChanged)
29 Q_PROPERTY(QVariant theme READ theme WRITE setTheme NOTIFY themeChanged)
30 Q_PROPERTY(KSyntaxHighlighting::Repository *repository READ repository WRITE setRepository NOTIFY repositoryChanged)
31
32public:
33 explicit KQuickSyntaxHighlighter(QObject *parent = nullptr);
34 ~KQuickSyntaxHighlighter() override;
35
36 QObject *textEdit() const;
37 void setTextEdit(QObject *textEdit);
38
39 QVariant definition() const;
40 void setDefinition(const QVariant &definition);
41
42 QVariant theme() const;
43 void setTheme(const QVariant &theme);
44
45 KSyntaxHighlighting::Repository *repository() const;
46 void setRepository(KSyntaxHighlighting::Repository *repository);
47
48Q_SIGNALS:
49 void textEditChanged() const;
50 void definitionChanged() const;
51 void themeChanged();
52 void repositoryChanged();
53
54private:
55 KSyntaxHighlighting::Repository *unwrappedRepository() const;
56
57 QObject *m_textEdit;
58 KSyntaxHighlighting::Definition m_definition;
59 KSyntaxHighlighting::Theme m_theme;
60 KSyntaxHighlighting::Repository *m_repository = nullptr;
61 KSyntaxHighlighting::SyntaxHighlighter *m_highlighter = nullptr;
62};
63
64#endif // KQUICKSYNTAXHIGHLIGHTER_H
65

source code of syntax-highlighting/src/quick/kquicksyntaxhighlighter.h