##// END OF EJS Templates
Redo CMake build system, get Qt5 support...
Redo CMake build system, get Qt5 support Qt5 support as discussed here: 3fbe">http://sourceforge.net/p/pythonqt/discussion/631392/thread/5f20c176/3fbe

File last commit:

r205:706df4355685
r205:706df4355685
Show More
PygmentsHighlighter.cpp
43 lines | 1.1 KiB | text/x-c | CppLexer
/*! \file PygmentsHighlighter.cpp
* \brief implements PygmentsHighlighter
* \author "Melven Zoellner" <melven@topen.org>
*
*/
#include "PygmentsHighlighter.h"
#include <PythonQt.h>
PygmentsHighlighter::PygmentsHighlighter(QTextDocument *parentDoc) :
QSyntaxHighlighter(parentDoc)
{
// create an own pythonqt context for the highlighter
_context = PythonQt::self()->createUniqueModule();
// name this object
setObjectName("pygmentsHighlighter");
// make it accessable in pythonqt,
// this allows to delegate the work in highlightBlock
// to a python function
_context.addObject(objectName(),this);
// initialize python
_context.evalFile("PygmentsHighlighter.py");
}
// just delegate the protected method setFormat from base class
void PygmentsHighlighter::_setFormat(int start, int count, const QTextCharFormat &format)
{
setFormat(start, count, format);
}
void PygmentsHighlighter::highlightBlock(const QString &text)
{
// call python function to do everything
QVariantList args;
args.append(text);
_context.call("highlightCode", args);
}