PDA

View Full Version : QCompleter + QSqlTableModel problem



Lykurg
11th March 2007, 14:07
Hi,

for a QLineEdit I set up a QCompleter with an QSqlTableModel, which works for the letter 'a'. When I enter a 'b', I get no completions, but when I scroll in a QTableView with the same model to 'b', then the QCompleter also displays completions.

So I guess the QCompleter only works with the initial read items of the model. How to tell QCompleter to work with the whole Table (~ 59.000 items)?

Thanks,
Lykurg

wysota
11th March 2007, 15:55
The model is probably trying to delay fetching all the rows as long as possible to minimise the latency needed to initialise itself. You might try manually accessing the last item from the model. It might force it to fetch all the remaining elements.

Lykurg
11th March 2007, 20:59
Yes, by forcing the model to load all data via
while ( model->canFetchMore() )
model->fetchMore(); all works fine, but in that case a QStringListModel with fetching the database fields by hand is better. (VmRSS is up to 2000 kB smaller)

Lykurg