PDA

View Full Version : QTextEdit super slow resize



bunjee
12th May 2008, 19:27
QTextEdit * test = new QTextEdit;
QString string;
for (int i = 0; i < 50000; i++)
{
string += 'o';
}
test->setText(string);
test->show();

== Super slow window resize.

How can I optimize this ?

pherthyl
12th May 2008, 21:14
I assume its the word wrap that's killing your performance here. If you really need fast resizes, I would suggest manual word wrap + scroll bars.

bunjee
12th May 2008, 22:51
You're right, the word wrap seems to be the reason.

Did you implement your own wordwrap algorithm ? Why is qt's default one so slow ?

fullmetalcoder
13th May 2008, 11:33
Why is qt's default one so slow ?
Because it requires the layout of the whole document to be re-computed, which can be a quite time-consuming operation.

jpn
13th May 2008, 12:49
How about QPlainTextEdit...

bunjee
13th May 2008, 18:09
I'll take a look.