Results 1 to 13 of 13

Thread: Reading lots of Data from QProcess without freezing

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Thumbs up Re: Reading lots of Data from QProcess without freezing

    wysota: I am using append to insert line by line. Before I check every line with a QRegExp for containing links
    high_flyer: Using setText seems not to be a option, since the QTextEdit works like a console (line after line and not 500 lines once)

    Using PlainTextEdit gives a far more better performance. Thats what I need. Sadly PlainTextEdit does not support links (which I need), but maybe its better to do a tradeoff here:

    Under normal circumstances the performace of QTextEdit is ok. Only if a lot of output is produced I ran into problems. Maybe I should switch from QTextEdit to a PlainTextEdit if my internal buffer reaches a specific size (that should be an indicator, that the inserting is to slow) I should switch to a PlainTextEdit. Than I lost the links, but the program remains stable and fast.

    Nevertheless I have another idea: I already limited the maximum lines to 1000. I also observed, that sometimes my internal buffer reaches 50.000 remaining lines. In the PlainTextEdit the are inserted really fast (to fast to follow) and maybe its a good idea to skip just 49.000 lines and show only the last 1000 lines, since the other lines are useless for the user.
    Last edited by nightghost; 22nd January 2010 at 12:52.

  2. #2
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Thanks
    6
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Reading lots of Data from QProcess without freezing

    Quote Originally Posted by nightghost View Post
    ... and maybe its a good idea to skip just 49.000 lines and show only the last 1000 lines, since the other lines are useless for the user.[/INDENT]
    That's just what I thought when reading this topic.
    Why would you try to show something on screen when it's already to fast to be handled in software?
    There are other ways to keep your users informed that something is happening behind the curtains...

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Reading lots of Data from QProcess without freezing

    Quote Originally Posted by nightghost View Post
    wysota: I am using append to insert line by line.
    Bad idea, this method is terribly slow. Use QTextCursor interface instead.

    Before I check every line with a QRegExp for containing links
    Ouch, that slows it down even more. What do you need the links for?

    Using PlainTextEdit gives a far more better performance. Thats what I need. Sadly PlainTextEdit does not support links (which I need), but maybe its better to do a tradeoff here:
    It's not a big of a problem. You can visually mark the links using a syntax highlighter (which will make your QRegExp go away or at least move to a different place) and then you can handle the links by implementing mouse event handlers for your editor.

    Under normal circumstances the performace of QTextEdit is ok.
    I would certainly not agree with that statement.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Reading lots of Data from QProcess without freezing

    1.) A ok. I did'nt know, that this would make a difference
    2.) The output is mostly from the GCC. The QRegExp is used to detect absolute paths and make links of them to click and jump (warnings, errors messages)
    3.) Nice idea, but is this really faster? Matching the links in the SyntaxHighLighter or before adding sounds not like a big difference. But it sounds like a good idea to enable the link-feature and leave the log output untouched
    4.) Hmm, ok :-) Its fast enough to be not annoying ;-)

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Reading lots of Data from QProcess without freezing

    Quote Originally Posted by nightghost View Post
    3.) Nice idea, but is this really faster? Matching the links in the SyntaxHighLighter or before adding sounds not like a big difference. But it sounds like a good idea to enable the link-feature and leave the log output untouched
    In "my" version you are using plain text. In "your" version you are using rich text with injected html tags. There is a huge difference.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    nightghost (25th January 2010)

  7. #6
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Reading lots of Data from QProcess without freezing

    Ah ok. The SyntaxHighligher is a lot faster in formating the text then the rich-text engine. Thanks for the tip

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Reading lots of Data from QProcess without freezing

    The rich text engine has to parse the text each time it is being laid out (or at least each time the text changes). The syntax highlighter uses QTextDocument infrastructure.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #8
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    131
    Thanks
    11
    Thanked 16 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Reading lots of Data from QProcess without freezing

    Thanks for the explanation. I'll have to investigate that further

Similar Threads

  1. Reading data from xls file
    By addu in forum Qt Programming
    Replies: 2
    Last Post: 6th May 2010, 09:33
  2. QProcess and reading data from xterm
    By sawerset in forum Qt Programming
    Replies: 0
    Last Post: 9th February 2009, 20:48
  3. Best way to display lots of data fast
    By New2QT in forum Newbie
    Replies: 4
    Last Post: 16th October 2008, 22:46
  4. Reading from a QProcess
    By drhex in forum Qt Programming
    Replies: 6
    Last Post: 3rd July 2008, 17:07
  5. Reading binary data
    By vermarajeev in forum Qt Programming
    Replies: 1
    Last Post: 13th August 2007, 09:14

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.