[Qt-interest] Poor performance of "setBackground()" API in QTableWidgetItem class in Qt 4.5.1

Mark Pereira mark at softjin.com
Thu Jun 11 10:20:31 CEST 2009


Hi Seam,

In my application I need to set the background color of couple of cells 
in the table only, so setting the background of the complete table wont 
work.

Regards,
Mark

Sean Harmer wrote:
> Hi,
>
> On Thursday 11 Jun 2009 04:26:25 Mark Pereira wrote:
>   
>> Hi,
>>
>> I have been using Qt 4.3.3 for a while and have recently moved to
>> Qt4.5.1. I have noticed that the performance of the "setBackground()"
>> API of QTableWidgetItem class has slowed down dramatically.
>>
>> I have attached a sample piece of code which can be used to reproduce
>> this problem. In Qt 4.3.3. it takes around 407msec to complete setting
>> the background, while in Qt 4.5.1 it takes 68,567msec for the same task.
>> I ran this test on a Intel Core Duo PC (1.8 GHz) with 2 GB RAM.
>>
>> Any suggestions as to how to improve this performance.
>>     
> Why not set the background colour of the whole widget just once rather than 
> setting the background colour of each of many items
>   
> Two simple ways to do this:
>
> (i) Set the Base color in the widgets pallet and then setAutoFillBackgrround( 
> true ).
>
> or 
>
> (ii) Use a simple style sheet:
>
> QTableWidget {
> background-color: yellow;
> }
>
> Cheers,
>
> Sean
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>   



Business Disclaimer
____________________________________________________________
This e-mail message and any files transmitted with it are intended solely
for  the use  of the  individual or entity  to which they  are  addressed. It
may  contain confidential,  proprietary or legally  privileged  information.
If  you  are  not  the  intended recipient please be advised that you have
received  this  message in error and any use is strictly prohibited. Please
immediately  delete it  and all copies of it from your system, destroy any
hard  copies  of  it and  notify  the  sender  by return mail. You must not,
directly or indirectly, use,  disclose,  distribute, print, or copy any part of
this message if you are not the intended recipient.
___________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090611/091fa699/attachment.html 


More information about the Qt-interest-old mailing list