-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathPygmentsHighlighter.h
44 lines (33 loc) · 1.15 KB
/
PygmentsHighlighter.h
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
/*! \file PygmentsHighlighter.h
* \brief defines PygmentsHighlighter
* \author "Melven Zoellner" <[email protected]>
*
*/
// include guard
#ifndef PYGMENTSHIGHLIGHTER_H
#define PYGMENTSHIGHLIGHTER_H
// PythonQt-includes
#include <PythonQt.h>
// Qt-includes
#include <QSyntaxHighlighter>
// local includes
#include "SimpleConsole.h"
/*! \brief A syntax-highlighter for python using pygments (from python)
*
* \warning partly implemented in python, see PygmentsHighlighter.py
*
*/
class PygmentsHighlighter : public QSyntaxHighlighter
{
Q_OBJECT
public:
explicit PygmentsHighlighter(QTextDocument *parentDoc = 0); //!< constructor
public slots:
void _setFormat(int start, int count,
const QTextCharFormat &format); //!< allows to call setFormat from within python
protected:
void highlightBlock(const QString &text); //!< does the actual highlightning, overwritten method from baseclass
private:
PythonQtObjectPtr _context; //!< own context, so the python-code is not executed in the global context
};
#endif /* PYGMENTSHIGHLIGHTER_H */