[Qt-interest] Slow QTreeWidget

Malyushytsky, Alex alex at wai.com
Thu Mar 26 00:00:02 CET 2009


I am not a guru in profiling. It depends on your compiler. But here is one of the link you might be interested in:
http://msdn.microsoft.com/en-us/library/aa289170.aspx


Also in your case you might not even need it.

Start with simple example similar to mine.
See if it works ok on your computer.
If it is, the problem probably is related to the way you prepare the data.
Try to exclude preparation from filling the widget, if it is not.

If it does not, try to do your own simple profiling.
Put qDebug statements with system time and row number in the critical places of your function. For example before and after the function call where you are trying to find if record already exist, after you fill first and second column, after you fill all other columns. See what really takes time.

As for me it does not sound as setText problem, especially if you tried to disable updates (this supposed to prevent QTableWidget to start re-layouting which may take significant time) and got no improvement.

The only non-constant time operation I can see (if update is disabled and data is prepered outside the loop where your function is called), is

moduleRsltList->findItems (QString::number(rnr), Qt::MatchExactly,0);

Personally I don't like usage of this function to find, if item is already there, cause it takes twice longer in average then simple iteration and much longer then if you built a map, but for 50 rows it should not make the difference.


Regards,
   Alex


-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Kenneth Beck
Sent: Wednesday, March 25, 2009 2:56 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Slow QTreeWidget

Malyushytsky, Alex wrote:
> You might want profile your code. The problem might be not in the tree.
>
> I made a simple test application. Filled tree using your function (50 rows, 15 columns) and it is filled within 1 sec as it was.
>
> Tested on Windows XP 64 bit, QT 4.4.3.
>
> Regards,
>          Alex
>
>
Wow, thanks for the work! I am not sure how to get a profiler for
windows, have been wondering how to do that. Can you point me to one?

Having said that, i am 90% certain it is in the setText line, just from
putting calls to the progressBar in various places.
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."

"Please consider our environment before printing this email."




More information about the Qt-interest-old mailing list