Ok, I started looking at the code:
{
if (!d->currentBlock.isValid())
return -1;
const QTextBlock previous
= d
->currentBlock.
previous();
if (!previous.isValid())
return -1;
return previous.userState();
}
int QSyntaxHighlighter::previousBlockState() const
{
Q_D(const QSyntaxHighlighter);
if (!d->currentBlock.isValid())
return -1;
const QTextBlock previous = d->currentBlock.previous();
if (!previous.isValid())
return -1;
return previous.userState();
}
To copy to clipboard, switch view to plain text mode
and d->currenltBlock is defined as:
class QSyntaxHighlighterPrivate : public QObjectPrivate
{
...
...
};
class QSyntaxHighlighterPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QSyntaxHighlighter)
...
QTextBlock currentBlock;
...
};
To copy to clipboard, switch view to plain text mode
And I do see that QTextBlock::userState() is public, which means you can know the state of the beginning of a paragraph. Much simpler then I thought of ... even tough it's "not good enough for me".
Bookmarks