[PyQt] Model/View with multiple thread

Sebastian Vetter svetter at s-vetter.org
Fri Feb 8 07:49:26 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hallo everyone,

I've started working with the Model/View concept and have some questions
on implementing it in a multithreading environment. I hope that some of
you have some ideas or advice on that and I'll highly appreciate any!

So that's the basic structure: I'm working on an application that's
processing data in a spreadsheet class. All processing in done in a
separate thread and communicates with the GUI thread through multiple
signals and slots. I now implemented a model in the GUI thread handling
the exact same spreadsheet object, since the Model and View have to live
in the same thread (is that right?).

Thinking about how to keep the spreadsheet objects in worker and main
thread synchronised I came up with two ideas:

1. Using signals and slots in both the worker and the model to update
their spreadsheet objects whenever the other one changes.

2. Using a thread-safe singleton of the model to handle one single
instance of the spreadsheet that are used in both threads.

What would be considered a 'better' solution? Is there any other
alternative that might work even better?

I really appreciate any thoughts on this. Thanks in advance.

Regards,
Seb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHrAmG/ZEwc0fz/xMRAhmwAJ9Z7N4Tja1ag9i1J40kuRFLLBCzFwCfY7mF
TluK9BdA8xxpWY1I7nzzCWg=
=1WoK
-----END PGP SIGNATURE-----


More information about the PyQt mailing list