[Qt-interest] Slow? painting of rows in QTableWidget

Andreas Pakulat apaku at gmx.de
Wed Mar 25 20:42:26 CET 2009


On 25.03.09 18:29:36, Sandro Frenzel wrote:
> Hello,
> 
> I experiment with tables in QT4. I create a QTableWidget and insert 600 new rows. It takes 5 seconds on a 2,5 GHZ Intel Core2Duo to paint all rows.
> 
> My question: Is that normal? Can I accelerate this operation?

Did you profile your app to see where the time is spent? If you add all
items in a short loop that should be relatively fast as there's no
gui-updates in between. However the tablewidget class might do layout
recalculations on each new row, you can help with that by specifying that
your items all have the same height and/or width (there's a setter for that
in the QTableView base class).

Another downside of qtablewidget is that you can't easily add n rows at
once, with only one relayouting being done. For that you'd have to use
QTableView+Model (not sure wether QStandardItemModel would be of use for
that).

If that doesn't help you really need to profile your application.

Andreas
 
-- 
You will probably marry after a very brief courtship.



More information about the Qt-interest-old mailing list