[PyQt] Populate Model data in a separate thread
dcassidy36 at mass.rr.com
Mon Apr 27 08:39:22 BST 2009
How many items do you need to populate in your model class? Unless you are
populating a view with thousands of items, I do not suggest threads at all
since they can be dangerous if you do not know how to use them.
If you absolutely needed to do this, my approach would be to have some sort
of method I could call on my dialog to fetch items in a separate thread in
the model, and once I have my data I could populate myself and call the
appropriate begin/end methods on my QAbstractItemModel class.
If I knew what you were trying to accomplish, then maybe I could give you
some better guidance.
Edwin Marshall-2 wrote:
> I've been reading on qtcentre that it is possible to populate a model from
> a separate qthread in order to prevent a program from freezing before it
> loads, however the example code I have seen is a bit too much involved
> (and in c++) for me to comprehend. I was wondering if anyone knew of a
> pyqt program that did, or could point me toward some code snippets doing
> this. The only thing that I can gather is that I need to create the
> qthread in the __init__ method of my model and call it's run command.
> However, I can't figure out what exactly need to go in the run method, or
> what signals to emit/catch. Thansk in advance for any help
> PyQt mailing list PyQt at riverbankcomputing.com
View this message in context: http://www.nabble.com/Populate-Model-data-in-a-separate-thread-tp23219092p23251498.html
Sent from the PyQt mailing list archive at Nabble.com.
More information about the PyQt