blob: 1bd424de7c26a701d671ef50ec8eea10c707ae79 (
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
|
// Copyright (C) 2020 Alexis Jeandet.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <QColor>
#include <QPlainTextEdit>
#include <QRegularExpression>
#include <QSyntaxHighlighter>
namespace MesonProjectManager {
namespace Internal {
class RegexHighlighter : public QSyntaxHighlighter
{
const QRegularExpression m_regex{R"('([^']+)'+|([^', ]+)[, ]*)"};
QTextCharFormat m_format;
public:
RegexHighlighter(QWidget *parent);
void highlightBlock(const QString &text) override;
QStringList options(const QString &text);
};
class ArrayOptionLineEdit : public QPlainTextEdit
{
Q_OBJECT
RegexHighlighter *m_highLighter;
public:
ArrayOptionLineEdit(QWidget *parent = nullptr);
QStringList options();
protected:
void keyPressEvent(QKeyEvent *e) override;
};
} // namespace Internal
} // namespace MesonProjectManager
|