Hi,
is there a way to block all updates on a view (e.g. TableView). I want to update the views only if I emit signal.
Did anybody know a way how i can do this?
Best Regards
NoRulez
Hi,
is there a way to block all updates on a view (e.g. TableView). I want to update the views only if I emit signal.
Did anybody know a way how i can do this?
Best Regards
NoRulez
There is a property available - QWidget::updatesEnabled but be sure you know what you are doing.
Thank you very much, this seems to solve my problem.
Best Regards
NoRulez
Ok, it doesn't solve the problem, which means that the gui is still blocking.
I've attached a small example which demonstrate the problem.
I hope someone could help.
Best Regards
NoRulez
Do not show all your data at once, use fetchmore.
http://doc.qt.nokia.com/4.6/itemviews-fetchmore.html
Do your data parsing or loading in a thread or asynchronous and use that data to populate your model. Use fetchmore to prevent blocking.
Edit: To be more clear: in your thread you have this line: m_pModel->insertRows(m_pModel->rowCount(), 1);
Leave adding rows to the model, not your thread. Create a custom model, keep a list of data inside the model and add data to that list via your thread (signals will work very well for this). Then, when you scroll in your view, the model will check if there's more data to display and adds the next few rows.
Last edited by tbscope; 30th April 2010 at 12:42. Reason: Be more clear
QObject subclasses are not thread-safe, don't try accessing the model directly from a worker thread or this will lead to trouble. Use signals and slots instead. And update your model in chunks, not a row at a time.
Bookmarks