[Interest] QTextEdit is too slow - hints needed

William Hallatt goblincoding at gmail.com
Tue Jan 15 06:43:16 CET 2013


I've battled with the same issue. I still haven't got a final solution, but
the following did help me speed things up a bit (using QPlainTextEdit),:

m_yourPlainTextEdit->setUpdatesEnabled( false );   // disables receipt of
paint events
m_yourPlainTextEdit->setPlainText( lotsOfText );
m_yourPlainTextEdit->setUpdatesEnabled( false );   // enables receipt of
paint events

(you can obviously refer to the API documentation for further details re
"setUpdatesEnabled").

Hope that helps!

Regards,
William Hallatt


On 15 January 2013 02:19, 1+1=2 <dbzhang800 at gmail.com> wrote:

> Hi,
>
> You should use QPlainTextEdit instead of QTextEdit.
>
> Regards.
>
>
> On Tue, Jan 15, 2013 at 8:16 AM, JM <johnmiller at email.it> wrote:
>
>> Hi all,
>>
>> I am using QTextEdit to display log text files, just like the Unix
>> command tail -f.
>> My current implementation just displays the last 5 lines and then follows
>> the growing
>> log file, displaying lines as they come.
>> Now, I am asked to make QTextEdit display the whole file when the user
>> opens a file.
>> A log file can be very large. I tested it with a 2mbyte file, and
>> inserting data to QTextEdit
>> caused the GUI to freeze for almost 1 minute.
>> This is not acceptable, and I am looking for a solution. I have the
>> following questions:
>>
>> -) what is the fastest way to insert lots of text into QTextEdit?
>> -) should I go to the route of implementing my own QTextDisplay? If so,
>> should I use QAbstractScrollArea as class base? Any pointer to how to use
>> it?
>>
>> Thanks in advance,
>> JM
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130115/4b8aa036/attachment.html>


More information about the Interest mailing list