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. Doing Syntax Highlighting
Qt 6.11 is out! See what's new in the release blog

Doing Syntax Highlighting

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.8k 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.
  • D Offline
    D Offline
    diltsman
    wrote on last edited by
    #1

    I am thinking of using Qt Quick for a project that would involve doing syntax highlighting. Is this something that can be reasonably done with Qt Quick? I was looking at the TextEdit control, but I cannot figure out how to set colors and what-not after text has been entered.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jens
      wrote on last edited by
      #2

      At the moment there is unfortunately no easy way to do this apart from creating a text element from scratch in C++. In 5.1 we are going to introduce a new QQuickTextDocument interface which essentially exposes the C++ QTextDocument API to the Qt Quick items.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        diltsman
        wrote on last edited by
        #3

        So, this QQuickTextDocument should be usable for what I want, if I am willing to wait for 5.1, right?

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jens
          wrote on last edited by
          #4

          Yes. It should be trivial to port for instance this: http://qt-project.org/doc/qt-5.0/qtwidgets/richtext-syntaxhighlighter.html to work with Qt Quick since they share the same QTextDocument API now.

          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