Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is there a way to loop through each block in a text document/qplaintextedit
Forum Updated to NodeBB v4.3 + New Features

Is there a way to loop through each block in a text document/qplaintextedit

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 3 Posters 1.0k 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.
  • F Offline
    F Offline
    Fuchsiaff
    wrote on last edited by
    #1

    I am trying to write my own syntax highlighter because the one provided by Qt5 doesn't let me highlight only certain blocks, it highlights all the blocks and that will cause performance issues with big files.

    Gojir4G 1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2
      This post is deleted!
      1 Reply Last reply
      2
      • F Fuchsiaff

        I am trying to write my own syntax highlighter because the one provided by Qt5 doesn't let me highlight only certain blocks, it highlights all the blocks and that will cause performance issues with big files.

        Gojir4G Offline
        Gojir4G Offline
        Gojir4
        wrote on last edited by
        #3

        @Fuchsiaff Hi,
        Something like this maybe :

        for (QTextBlock it = doc->begin(); it != doc->end(); it = it.next())
                cout << it.text().toStdString() << endl;
        

        source: https://doc.qt.io/qt-5/qtextdocument.html#end

        1 Reply Last reply
        5

        • Login

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