[Qt-interest] Stacking / Multiple QSyntaxHighlighter on one document?
Diego Iastrubni
diegoiast at gmail.com
Mon Jun 6 08:42:52 CEST 2011
On Mon, Jun 6, 2011 at 8:23 AM, Wilhelm <wilhelm.meier at fh-kl.de> wrote:
> if I understand the implementation of QSyntaxHighlighter correct, it
> should be possible to install more than one highlighter instances onto
> one document, e.g. one generic highlighter for code editing which does
> parenthesis matching, and then one for a specific language.
>
> But there seems no way to add more than one QTextBlockUserData object
> for one QTextBlock. So if I install more than one highlighter using
> QTextBlockUserData the second one destroys the user data of the first one.
>
> Any chance to get that right?
Solution is simple: just assume that the block data object will have a
container, and you are done.
BTW: for parenthesis use set/getExtraSelections
http://doc.qt.nokia.com/main-snapshot/qplaintextedit.html#setExtraSelections
More information about the Qt-interest-old
mailing list