Results 1 to 3 of 3

Thread: example of QPlainTextEdit subclass to handle large text files

  1. #1
    Join Date
    Feb 2012
    Posts
    10
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default example of QPlainTextEdit subclass to handle large text files

    Hi all,

    I'm working on a log parser, and I wanted to be able to open multiples text files of 50Mo or more.
    I've made a text component based on QPlainTextEdit with threads to address this. It's probably ugly and undocummented, but it seems to work at least. I don't have that much time to spend on this, so I provide it as-is in case it is useful to anyone.
    The principe is the following:
    -When you load a file, a thread is started to index the file, meaning it will note the offest in the file every X lines (configurable in options.h) to allow fast seeking
    -When you scroll (custom scrollbar), if you scroll to a position that is not in memory, another thread is used to get the text and update the text. If you continue scrolling before the thread is complete, the current reading task will abort and the thread will start to read the new position.

    I have also added a side panel with the line numbers from an example i've seen around.

    Feel free to ask me if you have any question, but I don't guarantee i'll answer.
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2012
    Location
    Germany
    Posts
    3
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: example of QPlainTextEdit subclass to handle large text files

    Hi i tried to compile your Code but im missing customtextedit.h could you provide the whole project pls ?
    Because this sounds exactly of what i need.

  3. #3
    Join Date
    Feb 2012
    Posts
    10
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: example of QPlainTextEdit subclass to handle large text files

    I have merged this into another project, so attaching the other project. It's messy and far from being finished though...
    logXpert.zip

  4. The following 2 users say thank you to nekkro-kvlt for this useful post:

    DrQuade (17th October 2012), UVV (12th April 2016)

Similar Threads

  1. How can we handle large files in qt?
    By aurora in forum Qt Programming
    Replies: 2
    Last Post: 13th February 2012, 13:15
  2. large dll files issues
    By alireza.mirian in forum Qt Programming
    Replies: 6
    Last Post: 5th January 2011, 22:50
  3. Replies: 0
    Last Post: 17th December 2010, 17:08
  4. How to handle Large Immutable Document in QTextEdit
    By rcjohns in forum Qt Programming
    Replies: 1
    Last Post: 5th April 2010, 20:35
  5. transfer large files using qsocket
    By vishesh in forum Qt Programming
    Replies: 3
    Last Post: 2nd March 2007, 15:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.