PDA

View Full Version : QTableView number of rows and scrollbar issue



jnk5y
28th February 2006, 02:17
A QTableView is populated by an sqlite database table and has 1000+ rows. When I scroll to the bottom using the scrollbar it goes to about row 512 and then the scrollbar slider jumps up a bit to show that there are more rows. This happens again and again. I'm pretty sure this has to do with allocation but is there a way I can give the Table View the number of rows so that it can anticpate a proper scroll?

wysota
28th February 2006, 14:13
What model do you use?

jnk5y
1st March 2006, 02:35
QSqlTableModel

wysota
1st March 2006, 06:55
First check if your database driver can report the size of a query executed (using QSqlDriver::hasFeature(QuerySize)). It might be that it doesn't and it could be causing the effect you mention. You can then force reading the whole database like so (run it after "select()"):


while (myModel->canFetchMore())
myModel->fetchMore();