Thanks elcuco,
for the state, you can use QSyntaxHighlighter::currentBlockState.