Sorry, I can't understand your idea. Select() function is synchronous, it doesn't return until all data would be fetched. So where from should I call processEvents()?
Can you give some piece of example code?
Sorry, I can't understand your idea. Select() function is synchronous, it doesn't return until all data would be fetched. So where from should I call processEvents()?
Can you give some piece of example code?
I have a QSqlTableModel. I fill it with data using setFilter() or select() methods of QSqlTableModel. Both are synchronous (they don't return until all records would be fetched). Operation can take more then 5 minutes.
Everything I need to know is just how much records were fetched so far.
I've tried to make static QSqlTableModel object, fill it with data in separate thread and call rowsCount() (query->size()) in loop in main thread. It doesn't helps - rowsCount() (and query->size)) return 0 until model would be fully filled.
So is there any way to get QSqlTableModel filling progress info?
I see, I thought you were using QSqlQuery.
You might try connecting to QAbstractItemModel::rowsInserted() signal.
Too bad. I've checked the sources and it looks like QSqlTableModel (QSqlQueryModel actually) doesn't fetch the data row-by-row, but rather retrieves particular cells as needed in data() using QSqlQuery::seek().
Maybe you could create your own model that will load data using typical while( query.next() ) loop?
Bookmarks