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