In a Qt Quarterly http://doc.trolltech.com/qq/qq21-syntaxhighlighter.html article it is said that :
The article is talking about lines, not paragraphs.QSyntaxHighlighter makes this possible through its "state" mechanism. When we finish highlighting a line, we can associate a state with the line (e.g., "Inside C-Style Comment"), which we can retrieve when we start highlighting the following line. The state is stored as an int.
So, let's suppose I wanted to highlight comments like this :
### a comment
, maybe on several lines ###
Here 'text' is the QString argument of my highlightBlock method. I put inside some print statements for debugging purpose.
When I call it, having typed : "### a comment", highlightBlock's text returns "### a comment".
After pressing enter and typing the second line : ", maybe on several lines ###", highlightBlock's text returns :", maybe on several lines ###".
So it confuses me : its not a paragraph but the second line only. I expected :
"### a comment\n, maybe on several lines ###".
I must miss something here, but don't know what exactly.
Bookmarks