Important: Please read the Qt Code of Conduct -

How to get QSyntaxhighlighter's format outside?

  • I use QSyntaxHighlighter's subclass to highlight text, but when i use
    QTextFormat format = cursorForPosition(event->pos()).charFormat()
    in QPlainTextEdit::mousePressEvent, the format always is default.
    So I search for a way to get the format which apply in highlighter.(QSyntaxHighlighter::formatis protected...)

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Out of curiosity, why do you need that information like that ?