Qt6 topics merged with General

Format Text in TextArea and Code Completion

  • Hello,

    In my application, I use the TextArea Component from QtQuick Controls 2.x. I already found out how to highlight Code written in the TextArea, so for example keywords are written in purple automatically.

    But I wonder how I could implement Code completion.

    So let's say I write { or (, then there should be added } or ) automatically.

    And If I type in { and } is added automatically and I press enter, it should be like this:
    type in "{"

    ... {


    ... {}

    press enter

    ... {

    where "|" is the new cursor position.

    Should I do this in my extended QSyntaxHighlighter class? Or how can I achieve this behaviour?


    Best regards Leon

Log in to reply