Results 1 to 15 of 15

Thread: QTextEdit Performance handling large paragraphs

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Re: QTextEdit Performance handling large paragraphs

    I have had the same performance problems and solved them by looking at the problem from a completely different perspective.
    A human eye is only capable of viewing a certain amount of frames per second. Thus, when displaying fast data streams you don't have to render the screen after each new line as the human eye could not see it.
    What you want to do is seperate the original problem into two entirely unrelated problems, i. e. the buffer and the viewer problems.

    I needed a very fast text stream control with character format support such as foreground and background colors, bolding, underlining and italics for an open source MUD client project. QTextEdit was *way* too slow. QPlainTextEdit is a bit faster, but still way too slow. The problem is the underlying QTextDocument and its complex rendering. The drawing performance itself is not the problem. I use two synchronized buffers. A std::deque<std::deque<TChar*> > structure for the character format (TChar) and a synchronized QStringList for the text itself. This has the advantage that you can do fast string lookups and replacements without the need to adapt the corresponding format buffer if there is a need to do so.

    The display itself renders snapshots of the part of the buffer that is of interest. In a streaming scenario this is usually the end of the buffer unless the user scrolls up in the buffer in which case the display control renders the part of the text buffer that is visible on the screen at that particular time. This way the user has real time access to any part of the text buffer that he is interested in.

    The text rendering itself can be optimized greatly, by only rendering the text of the new lines that have not been rendered yet and scrolling up old lines in the graphics buffe as rendering text is inherently complex and slow.

    If some part in the buffer changes and that particular part of the screen is currently displayed, then you only want to update the rectangles of the affected characters and not the entire screen.

    Anyways, the speed is outstanding now.

    You can have a look at the code here:
    http://github.com/HeikoKoehn/mudlet/tree/master

  2. #2
    Join Date
    Jul 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTextEdit Performance handling large paragraphs

    It appears that the link : "http://github.com/HeikoKoehn/mudlet/tree/master" is down.
    Do you have a new one?

  3. #3

    Default Re: QTextEdit Performance handling large paragraphs

    main site: http://www.mudlet.org
    source code available here: http://mudlet.git.sourceforge.net

Similar Threads

  1. [QT 4] QTextEdit performance
    By fellobo in forum Qt Programming
    Replies: 8
    Last Post: 6th March 2006, 19:27

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.