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

QML TextEdit selectionColor / selectedTextColor when using a QSyntaxHighlighter



  • Hi, I am writing a simple text editor using QML with some basic syntax highlighting delivered from a custom QSyntaxHighlighter class.

    The result looks like this:
    35fbfea4-3162-4514-a8e6-50a79b4b2066-image.png

    Beautiful! However when I select some text it ends up looking like this:
    45f6575d-5a5e-4706-b05e-176ef50b3c98-image.png

    As you can see the text all becomes white. I would like the text colour to not change and to retain my syntax highlighting colours but I'm not sure how to do this with a TextEdit.
    I know that the qml TextEdit component has properties for the selection colour (selectionColor) and the selected text color(selectedTextColor) but I see no way to have no selected text colour.

    Hopefully there's an easy way here that I'm missing.


Log in to reply