Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-28279

Add support for QSyntaxHighlighter TextEdit

    XMLWordPrintable

Details

    Description

      Currently there's no way easily implement spell checking or syntax highlighting in TextEdit, similar to QTextEdit. An easy solution to allow users to subclass QSyntaxHighlighter and set the syntax highlighter in TextEdit, as a property.

      For example:

      TextEdit {
         ...
      
         syntaxHighlighter: MySpellCheckingSyntaxHighlighter { }
      
         ...
      }
      

      The text edit would automatically subclassed QSyntaxHighlighter's document to the TextEdit's internal QTextDocument.

      Other option is to expose TextEdit's internal QTextDocument, as a property. The user could grab the QTextDocument, from TextEdit in qml, and pass to c++, where users can assign it to a subclassed QSyntaxHighlighter.

      Adding a syntaxHighlighter option to TextEdit seems to be more straight forward. Users could still extract the TextEdit QTextDocument via the QSyntaxHighlighter.

      Perhaps we should add both the document and syntaxHighlighter to TextEdit?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            aalpert Alan Alpert
            vpicaver Philip Schuchardt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes