Results 1 to 5 of 5

Thread: Storing and displaying "large" amount of data

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,316
    Thanks
    314
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Storing and displaying "large" amount of data

    I don't see any obvious memory leaks, unless you are calling this method more than once. Each time through you create a new QTextDocument instance; if you aren't getting rid of these and are calling this method over and over, then you'll keep accumulating dangling pointers to the old documents and using up more and more memory.

    This really does scream to be represented as a table. You're formatting it that way, so just use a QTableWidget or QTableView and turn off the grid lines.

    The amount of time could be because the document is recomputing its internal layout with each line you add to it and possibly pushing everything onto undo / redo stacks with each addition. The default value for the undoRedoEnabled property is true, and I don't see where you disable it. So you might have an undo stack with 500K blocks on it.
    Last edited by d_stranz; 27th November 2014 at 18:52.

  2. The following user says thank you to d_stranz for this useful post:

    FreddyKay (27th November 2014)

  3. #2
    Join Date
    Jun 2013
    Posts
    20
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Storing and displaying "large" amount of data

    Quote Originally Posted by d_stranz View Post
    I don't see any obvious memory leaks, unless you are calling this method more than once. Each time through you create a new QTextDocument instance; if you aren't getting rid of these and are calling this method over and over, then you'll keep accumulating dangling pointers to the old documents and using up more and more memory.

    This really does scream to be represented as a table. You're formatting it that way, so just use a QTableWidget or QTableView and turn off the grid lines.

    The amount of time could be because the document is recomputing its internal layout with each line you add to it and possibly pushing everything onto undo / redo stacks with each addition. The default value for the undoRedoEnabled property is true, and I don't see where you disable it. So you might have an undo stack with 500K blocks on it.
    Alright. Thanks a lot you two. I'll give QTableView a try, though I will also try disabling the undoRedo thingy.

Similar Threads

  1. Replies: 2
    Last Post: 3rd January 2012, 15:00
  2. Storing the program data in a "safe place"
    By kremuwa in forum Qt Programming
    Replies: 9
    Last Post: 5th August 2010, 10:23
  3. Replies: 1
    Last Post: 7th April 2010, 21:46
  4. Replies: 3
    Last Post: 25th August 2009, 13:03
  5. Guidance for displaying "updating" data!
    By Humble in forum Qt Programming
    Replies: 1
    Last Post: 3rd July 2007, 13:35

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
  •  
Qt is a trademark of The Qt Company.