Handling large strings (e.g. log files) in TextArea/TextEdit
-
I have a serial console application I've written, and its job is to display the incoming serial data. I use a TextArea because it integrates nicely into Flickable (via the Flickable.TextArea property). This works extremely well, in terms of it giving me the desired visual results and look and feel. It also lets me have fun features like the ability to highlight large blocks of text in one view and map those across views (for instance, if I wanted to see the ASCII text in one view and the corresponding hex code in another)
The problem is that as the string of text gets longer and longer, the performance starts falling off the cliff. Adding new data causes the application to start to lag. And not after several MB of characters, but maybe after just a thousand lines or so.
I have spent several hours this morning looking for a solution to this problem, and haven't found anything which looks like it could do the job. I very much need/want all the good things which come with the TextArea, I just don't want it to bog down the program.
I've followed the following advice in the TextEdit documentation:
In order to append without inserting a new paragraph, call myTextEdit.insert(myTextEdit.length, text) instead.
I also use
textFormat: TextEdit.PlainText
(although I would have liked to be able to use rich text so I can give more semantical meaning to the view).Is it fair to expect TextArea to be able to handle thousands of lines? If not, what is the right answer? Is there something similar to where I can have my cake and eat it to?