[Qgis-developer] Multithreading not working in QGIS Python plugins?

Stefan Keller sfkeller at gmail.com
Mon Aug 17 01:35:26 PDT 2015


Hi,

We're having problems not being able to start a new QThread as described here:
"using python multiprocessing package inside a qgis plugin code" [1]

We've already looked around and found this often referenced blog post
by snorfalorpagus [2] and [3] which boils down to this snippet:

    # start the worker in a new thread
    thread = QtCore.QThread(self)
    worker.moveToThread(thread)  # worker is an object derived from QObject
    thread.started.connect(worker.run)
    thread.start()

The problem is, that a new thread id is being created but the main
thread remains blocked.
Any ideas?

--Stefan

[1] http://stackoverflow.com/questions/31692980/using-python-multiprocessing-package-inside-a-qgis-plugin-code
[2] http://snorf.net/blog/2013/12/07/multithreading-in-qgis-python-plugins/
[3] http://gis.stackexchange.com/questions/98335/how-to-enable-multithreaded-processing-in-qgis-2-2/112688#112688


More information about the Qgis-developer mailing list