nngn
Loading...
Searching...
No Matches
source_editor.h
Go to the documentation of this file.
1#ifndef NNGN_TOOLS_AUDIO_SOURCE_EDIT_H
2#define NNGN_TOOLS_AUDIO_SOURCE_EDIT_H
3
4#include <QRegularExpression>
5#include <QSyntaxHighlighter>
6#include <QPlainTextEdit>
7
8#include "utils/utils.h"
9
10namespace nngn {
11
12class LuaSyntaxHighlighter final : public QSyntaxHighlighter {
13 Q_OBJECT
14public:
15 LuaSyntaxHighlighter(QTextDocument *parent = nullptr);
16private:
17 struct category {
18 std::vector<QRegularExpression> regexps = {};
19 QTextCharFormat fmt = {};
20 int group = 0;
21 };
22 void highlightBlock(const QString &text) final;
23 std::vector<category> categories = {};
24};
25
26class SourceEditor final : public QPlainTextEdit {
27 Q_OBJECT
28public:
30 SourceEditor(QWidget *parent = nullptr);
31 using QPlainTextEdit::QPlainTextEdit;
32signals:
33 void updated(QString s) const;
34private:
35 void keyPressEvent(QKeyEvent *e) final;
36 void dropEvent(QDropEvent *e) final;
38};
39
40}
41
42#endif
local class const
Definition animation.lua:7
Definition source_editor.h:12
std::vector< category > categories
Definition source_editor.h:23
void highlightBlock(const QString &text) final
LuaSyntaxHighlighter(QTextDocument *parent=nullptr)
Definition source_editor.h:26
void dropEvent(QDropEvent *e) final
void keyPressEvent(QKeyEvent *e) final
LuaSyntaxHighlighter * highlighter
Definition source_editor.h:37
void updated(QString s) const
Definition audio.cpp:7
#define NNGN_NO_COPY(x)
Definition utils.h:35
Definition source_editor.h:17
int group
Definition source_editor.h:20
std::vector< QRegularExpression > regexps
Definition source_editor.h:18
QTextCharFormat fmt
Definition source_editor.h:19
local e
Definition math.lua:4
std::chrono::seconds s
Definition timing.cpp:6