[Qt-interest] [Performance] Inserting thousands of rows

Stephan Rose kermos at somrek.net
Thu Jan 22 04:03:04 CET 2009


On Thu, 2009-01-22 at 02:40 +0100, Georg Grabler wrote:
> Hello,
> 
> 
> I've a question about performance (or visual performance) of an
> application
> 
> Let's take a common QTableWidget. Let's say I'd like to insert ....
> 10.000 rows. Now, usually my whole application (in most languages)
> will block, until the rows are inserted. So it does in QT at the
> moment, using a standard QT Designer form with a TreeView and a
> TableWidget.
> 
> Do you have any ideas to (in example) have an own thread handling the
> QTableWidget, so the rest of the application won't block, so I can
> still use the Menu / TreeView while the Table is loading?

One way would be to create a QTimer with an interval of 0 which will
make the timer fire it's timeout signal continuously when the
application isn't otherwise busy. Connect a slot to that signal and have
that slot add a few records to the table each time. When all records
have been added simply shut off the timer.

It's an easy way to get non-blocking behavior without going through all
the work necessary for multi-threading or custom models. 

Stephan





More information about the Qt-interest-old mailing list