Qt
Python
pqPythonSyntaxHighlighter.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2
// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3
// SPDX-License-Identifier: BSD-3-Clause
4
#ifndef pqPythonSyntaxHighlighter_h
5
#define pqPythonSyntaxHighlighter_h
6
7
#undef slots
8
#include "vtkPython.h"
9
#define slots Q_SLOTS
10
11
#include "pqPythonModule.h"
12
13
#include <QObject>
14
15
#include "
vtkPythonCompatibility.h
"
16
#include "vtkPythonInterpreter.h"
17
#include "
vtkSmartPyObject.h
"
18
19
class
QTextDocument;
20
class
QTextEdit;
21
class
QUndoStack;
22
23
struct
pqPythonTextHistoryEntry
;
24
38
class
PQPYTHON_EXPORT
pqPythonSyntaxHighlighter
:
public
QObject
39
{
40
Q_OBJECT
41
public
:
42
typedef
QObject
Superclass
;
48
explicit
pqPythonSyntaxHighlighter
(QObject* p, QTextEdit& textEdit);
49
~
pqPythonSyntaxHighlighter
()
override
=
default
;
50
55
bool
isReplacingTabs()
const
;
60
void
setReplaceTabs(
bool
replaceTabs);
61
65
QString Highlight(
const
QString& src)
const
;
66
72
void
ConnectHighligter()
const
;
73
78
static
void
ApplySyntaxFormatting(QTextDocument* dst,
const
QTextDocument& src);
79
80
protected
:
85
bool
eventFilter(QObject*, QEvent*)
override
;
86
87
private
:
88
QTextEdit& TextEdit;
89
90
vtkSmartPyObject
PygmentsModule;
91
92
vtkSmartPyObject
HighlightFunction;
93
94
vtkSmartPyObject
PythonLexer;
95
96
vtkSmartPyObject
HtmlFormatter;
97
102
bool
ReplaceTabs =
true
;
103
104
Q_DISABLE_COPY(
pqPythonSyntaxHighlighter
);
105
};
106
107
#endif
vtkSmartPyObject
pqPythonSyntaxHighlighter::Superclass
QObject Superclass
Definition:
pqPythonSyntaxHighlighter.h:42
vtkPythonCompatibility.h
pqPythonSyntaxHighlighter
This class is a helper object to attach to a QTextEdit to add Python syntax highlighting to the text ...
Definition:
pqPythonSyntaxHighlighter.h:38
vtkSmartPyObject.h
pqPythonTextHistoryEntry
Definition:
pqPythonUndoCommand.h:27
Generated by
1.8.13 on Mon Jul 6 2026