Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Example of TextEdit using a QSyntaxHighlighter
Forum Updated to NodeBB v4.3 + New Features

Example of TextEdit using a QSyntaxHighlighter

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 5.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Khertan
    wrote on last edited by
    #1

    Hi,

    I notice that TextEdit provide a textDocument that can be used (if i understand well the documentation) to be used to set a QSyntaxHighlighter to provide syntax highlight to TextEdit.

    But i fail to implement it. Someone have examples or source of apps using it ?

    Thanks a lot

    Benoît HERVIER - http://khertan.net/

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fuh.oliver
      wrote on last edited by
      #2

      We have made a QSyntaxHighlighter C++ subclass for Python highlighting. It's based on something we found for PyQt. And, yes, we also missed some example code or apps who use this, so I hope the example can be helpful:

      http://talktomachines.blogspot.com/2014/01/python-syntax-highlighting-for-qtextedit.html

      Oliver

      1 Reply Last reply
      0
      • K Offline
        K Offline
        Khertan
        wrote on last edited by
        #3

        Hi,

        Thanks for your example, that 's not really what i was looking for. I was looking for an example for using QSyntaxHighlighter in a QML TextEdit.

        Anyway, during this time, i finnaly found how to implement that based on the qml texteditor example. You can see a really really basic syntax highlighter i made for ownNotes (a markdown note taking Sailfish QML apps) at https://github.com/khertan/ownNotes/tree/master/Sailfish/ownNotes/src

        Regards

        Benoît HERVIER - http://khertan.net/

        1 Reply Last reply
        0
        • F Offline
          F Offline
          fuh.oliver
          wrote on last edited by
          #4

          Sorry, indeed I realize, you are talking QML TextEdit. I'll check your example, thanks!
          Oliver

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved