Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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 "{"

    ... {
    

    automatically

    ... {}
    

    press enter

    ... {
     |
    }
    

    where "|" is the new cursor position.

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

    Thanks!

    Best regards Leon


Log in to reply