How to scroll to the last line of a Sqlite model in a QTableView?

I have a Sqlite model of several 1000 rows attached to a QTableView. I can view rows in a QTableView, but when I scroll to the bottom of a QTableView, I can only get to the end of the first few rows. If I continue to press the scroll button, new lines are added to the view, but I cannot easily scroll to the end. After all the lines are added to the view, I can easily scroll from top to bottom without any problems.

Here's the important part of the code (which is standard):

self.db = QtSql.QSqlDatabase.addDatabase("QSQLITE")
self.db.setDatabaseName(dbFileName)

self.model = QtSql.QSqlTableModel(self.db)
self.model.setTable("results")
self.model.select()
self.tableViewResults.setModel(self.model)

I need to skip something very simple. Any suggestions?

Laurence.

+5
source share
1 answer

QSqlTableModel , .. , . QTableView , . , , , QSqlTableModel .

, SQL , SQLite - :

, . . FetchMore(). .

, , , .

, ( fetchMore):

self.db = QtSql.QSqlDatabase.addDatabase("QSQLITE")
self.db.setDatabaseName(dbFileName)

self.model = QtSql.QSqlTableModel(self.db)
self.model.setTable("results")
self.model.select()
while self.model.canFetchMore():
    self.model.fetchMore()
self.tableViewResults.setModel(self.model)
+6