QSqlRelationalTableModel only populates first 256 records QSqlRelationalTableModel only populates first 256 records sqlite sqlite

QSqlRelationalTableModel only populates first 256 records


The number of records is hard-coded as #define QSQL_PREFETCH 255 in the QSqlQueryModel class. To override it, you will have to explicitly fetch all the rows yourself:

while self.choicesModel.canFetchMore():    self.choicesModel.fetchMore()

You will probably need to run code like this every time the model is updated, so it might be better to create your own sub-class and reimplement fetchMore.