Why do you set the model again?
You don't seem to use different models.
Cheers,
_
Why do you set the model again?
You don't seem to use different models.
Cheers,
_
Because there was a change in the record.
Other example of code :
m_ModelProduct->setQuery(SQL_LOCAL_PRODUCTS);
proxyModel->setSourceModel(model);
proxyView->setModel(proxyModel);
proxyView->sortByColumn(1, Qt::AscendingOrder);
if I sort the table, it has a long delay to display the table records. If something changes in records I need to make a setQuery again and therefore a setModel, correct?
Last edited by Mhaylson; 21st August 2015 at 22:11.
That would explain setQuery(), so that the model can load the data again.
But why set the model again? It is the same model, right?
Only setQuery(), the pointer to the model stays the same when its data changes.
Anyway, setting the query means the model will reset and get all data from the database again.
Which might be the cause of the performance issue you are seeing.
If you know which records have been altered, you might be able to achieve partial updates by implementing your own model and handling the update yourself.
But better measure which part is the one that consumes most time.
Take the model without it being shown in any view and measure the time it takes for setQuery() to finish.
Cheers,
_
The problem is that I do not know which record was changed. Let's say the 33 thousand products, some was modified so I need to do further consultation with the heads setQuery, correct?
Bookmarks