KSyntaxHighlighting

kquicksyntaxhighlighter.h
1 /*
2  SPDX-FileCopyrightText: 2018 Eike Hein <[email protected]>
3  SPDX-FileCopyrightText: 2021 Volker Krause <[email protected]>
4 
5  SPDX-License-Identifier: MIT
6 */
7 
8 #ifndef KQUICKSYNTAXHIGHLIGHTER_H
9 #define KQUICKSYNTAXHIGHLIGHTER_H
10 
11 #include "repositorywrapper.h"
12 
13 #include <KSyntaxHighlighting/Definition>
14 #include <KSyntaxHighlighting/Theme>
15 
16 #include <QObject>
17 #include <QVariant>
18 
19 namespace KSyntaxHighlighting
20 {
21 class Repository;
22 class SyntaxHighlighter;
23 }
24 
25 class KQuickSyntaxHighlighter : public QObject
26 {
27  Q_OBJECT
28 
29  Q_PROPERTY(QObject *textEdit READ textEdit WRITE setTextEdit NOTIFY textEditChanged)
30  Q_PROPERTY(QVariant definition READ definition WRITE setDefinition NOTIFY definitionChanged)
31  Q_PROPERTY(QVariant theme READ theme WRITE setTheme NOTIFY themeChanged)
32  Q_PROPERTY(RepositoryWrapper *repository READ repository WRITE setRepository NOTIFY repositoryChanged)
33 
34 public:
35  explicit KQuickSyntaxHighlighter(QObject *parent = nullptr);
36  ~KQuickSyntaxHighlighter() override;
37 
38  QObject *textEdit() const;
39  void setTextEdit(QObject *textEdit);
40 
41  QVariant definition() const;
42  void setDefinition(const QVariant &definition);
43 
44  QVariant theme() const;
45  void setTheme(const QVariant &theme);
46 
47  RepositoryWrapper *repository() const;
48  void setRepository(RepositoryWrapper *repository);
49 
50 Q_SIGNALS:
51  void textEditChanged() const;
52  void definitionChanged() const;
53  void themeChanged();
54  void repositoryChanged();
55 
56 private:
57  KSyntaxHighlighting::Repository *unwrappedRepository() const;
58 
59  QObject *m_textEdit;
62  RepositoryWrapper *m_repository = nullptr;
63  KSyntaxHighlighting::SyntaxHighlighter *m_highlighter = nullptr;
64 };
65 
66 #endif // KQUICKSYNTAXHIGHLIGHTER_H
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Syntax highlighting repository.
Definition: repository.h:127
Q_SIGNALSQ_SIGNALS
A QSyntaxHighlighter implementation for use with QTextDocument.
Represents a syntax definition.
Definition: definition.h:86
Color theme definition used for highlighting.
Definition: theme.h:64
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Mar 26 2023 04:09:17 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.