PDA

View Full Version : Displaying Text Quickly



taylor34
1st March 2006, 02:01
Hello--

I made a post a few weeks back concerning being able to write to a text box quickly without having it lockup or become unresponsive. I had tried qtextedit and qlistview without success so someone suggested qtable. I tried qtable but that didn't work either--it works up until a certain point and then it couldn't keep up either. I did however get qtextedit to work in logtext mode--unfortunately, that basically takes away all selection abilities that I need.

I was hoping that someone here might be able to help in this. I've come the conclusion that I don't necessarily have to have the text displaying while I record it, but I'd like to have it displayed after I stop sending in text. I was thinking that I could store it to a file and then load it afterwords, but I'm not sure if that's a good idea or not. Hopefully somebody will have a good suggestion for me. Thanks

Aaron

wysota
1st March 2006, 08:06
Are you using Qt3 or Qt4?

Anyway, store your text in some datastructure, be it a simple QString (or QStringList) for Qt3 or a QTextDocument in Qt4 and after you're done feeding it, just send it to QTextBrowser or simmilar. You can use setUpdatesEnabled(false) to disable widget updates if you don't want to send the text at once.

taylor34
1st March 2006, 16:55
Thanks for the suggestion, I'll try that. Right now I'm putting about 1200 characters every 50 milliseconds into the text windows (qt 3.3), but writing it in 100 character increments. If I can somehow spool that up maybe it will work like I want to without causing performance issues. Thanks

Aaron

KjellKod
1st March 2006, 20:15
Wow you must be a fast reader ;)

Displaying the text that quickly wouldn't surprise me if it made the program sluggish. Do you need to display it or only to store it into a data structure?

taylor34
1st March 2006, 21:35
I do have to display it eventually. I tried putting in a qtable without displaying it but I think the shear number of qtable operations was killing it. Is there an efficient way to store a lot of incoming text and then be able to display it without delay after the incoming text has finished? Like maybe qstring list like somebody suggested before? Thanks

Aaron

newellm
2nd March 2006, 08:29
How are you receiving the data? It might be best to simply store a list(QStringList or QList<QByteArray>) of whatever you are receiving, and only join it together every certain time limit or when the data stops coming in. This will prevent copying data and doing screen update every 50 milliseconds. You could use a QTimer firing every 500ms or so to update the display, or just wait until until all the data is collected.

taylor34
2nd March 2006, 15:09
I queued up everything into a qstring list, and then write it to the textedit window--that seems to work great. However, if I add any rich text to it the scrolling becomes ridiculously slow (this is on a sun station, btw). Not sure if I can really do anything about that issue, unless there's some way to increase scrolling performance for text boxes (qt 3.3). Thanks everyone for all of your help so far.

Aaron