Search code examples
qtmultilineqtextdocument

Qt (PySide) multiline QSyntaxHighlighter


I need a QTextEdit that will feed my QSyntaxHilighter multiline blocks! I've narrowed down my search in to the QAbstractTextDocumentLayout but I can't really nail it. The documentation states:

A text block encapsulates a block or paragraph of text in a [...].QTextDocument.

Regardless of that, I can't find anything to set or override so I can get the required behavior. Can somebody point me to the right direction please? I'm oozing my brain out of my ears here!

Thanks.


Solution

  • the solution i found was to subclass the QtGui.QTextCursor state the patterns for the regular expressions i needed as in the QSyntaxHighlighter and use setCharFormat() on my selections.. (while blocking the signals).