[Qt-interest] QAbstractListModel Scrolling Performance Issue

Stephan Rose kermos at somrek.net
Wed Dec 3 18:52:40 CET 2008


>Try to simplfy the problem a bit..
>
>First... I would simply create a dummy model that had 40k rows, no SQL.
>See if the problem still exists..

Well a dummy model essentially is all this model is. While the model is fed from a SQL query using a slot, the two are completely separate from each other. So when ::data is called, the data is retrieved from the model's internal record storage not from the SQL Query.

>
>The main trick is going to be to represent the system your ::data() and
>model queries in the same way.
>
>If that doesn't show the problem you can look into the SQL side of
>things... Maybe there is a delay your not thinking of...

Can't be as I've made sure that the SQL query was fully finished and every single record submitted to the model's internal storage before attempting to scroll.

The whole point of my new implementation is to ensure that the model never has to wait on the SQL Server during a ::data() call. Even if the SQL Query was still busy retrieving additional data, the model woudln't even know about this. As far as the model is concerned, it always has all the data it's ever going to have until the addRecords slot is called and data is appended.

>
>If the delay is still there, then focus on the model and the view side
>of things.
>
>BTW What type of view are you using?

It's a QTreeView as I need a multi-column view and QListView doesn't seem to have that functionality as far as I can tell.

>
>Have your tried using QSqlQueryModel (or one of its derivatives) as the
>model?

Yep I have and I found it no better or worse than my original own implementation. Exact same results.

Thanks,

Stephan



More information about the Qt-interest-old mailing list