[Qt-interest] Reducing wait-time for users by local caching of data

Christopher Rasch-Olsen Raa christopher at technophile.info
Fri Jul 17 13:35:38 CEST 2009


Hi,

I've got an application with a good deal of QTableViews displaying contents of 
various tables in a database. A change in one of the tables will often render 
the contents of a couple of the other tableviews obsolete. So; a change one 
place needs to force a refresh of other tables.

I have implemented this and it works, albeit somewhat slowly. Querying the 
database (MySQL) takes upwards of 200ms pr view, something that gives an 
accumulated wait of several seconds in some usecases. Can't have it like that 
now can I?

I tried pushing the loading of data into a separate thread by way of 
QtConcurrent but that resulted in views that stopped working (selecting etc 
was no longer possible). Is a solution to just refresh the models, and then 
when the model-refreshes are done update the views? By 'update the views' I 
mean resizing columns / rows so they don't consume silly amounts of space like 
the default is.

I'm sure I must be doing something really stupid here but I can't put my finger 
on what that might be. I have tried to profile using callgrind and have been 
able to do some improvements, but not enough.

How do you people usually handle these things?

--
Christopher



More information about the Qt-interest-old mailing list