[Qgis-developer] In a QGIS plugin, can't start a thread from a QDockWidget control...
llamou at gmail.com
Thu Jul 31 07:16:41 PDT 2014
I have to convert a QGIS plugin (2.2.0-Valmiera 32 bits) from a QDialog to
a QDockWidget. While succeeding in doing the conversion (the plugin is now
docked), the threads which are launched from the plugin do not work
anymore. Any idea why this happens and how to solve this? Here is an
example showing my problem using only a QPushButton that starts a thread:
First, my plugDockDialog.py file:
class PlugDockDialog(QDockWidget, Ui_PlugDock): def __init__(self):
QDockWidget.__init__(self, None) self.setupUi(self)
and (the significant parts of) my plugDock.py file:
class PlugDock: def __init__(self, iface): self.iface = iface self.dlg =
PlugDockDialog() self.iface.addDockWidget( Qt.RightDockWidgetArea, self.dlg
) cmd = self.dlg.findChild(QPushButton,"cmdGo")
cmd.clicked.connect(self.cmdGoClick) # Thread method @staticmethod def
myfunc(i): time.sleep(3) print "Docking thread %d is finished..." % i #
Click method def cmdGoClick(self): t = Thread(target=self.myfunc,
Thank you for your help!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Qgis-developer