Multithreading pyqt线程qRegisterMetaType警告/崩溃
我正在使用QQ向导编写一个pyqt程序。在一个屏幕上,我运行一个线程,并通过Popen启动一个命令行程序。但是,我收到以下警告信息: QObject::connect:无法对“QTextCursor”类型的参数排队 确保使用qRegisterMetaType注册了“QTextCursor” 这个程序通常会继续,但在这一点之后,偶尔会崩溃,这让我觉得它是相关的 由于程序代码太多,无法附加,以下是相关代码片段:Multithreading pyqt线程qRegisterMetaType警告/崩溃,multithreading,pyqt,Multithreading,Pyqt,我正在使用QQ向导编写一个pyqt程序。在一个屏幕上,我运行一个线程,并通过Popen启动一个命令行程序。但是,我收到以下警告信息: QObject::connect:无法对“QTextCursor”类型的参数排队 确保使用qRegisterMetaType注册了“QTextCursor” 这个程序通常会继续,但在这一点之后,偶尔会崩溃,这让我觉得它是相关的 由于程序代码太多,无法附加,以下是相关代码片段: class Fee(QThread): def __init__(self, p
class Fee(QThread):
def __init__(self, parent=None, options=None):
QThread.__init__(self, parent)
#set the given options
if options:
self.__options = options
def copy(self, devicename, outputfilename):
self.__device = devicename
self.__outputfile = outputfilename
self.start()
def run(self):
cmd = self.__getCommandLine(self.options, self.__device, self.__outputfile)
logging.info("Running Fee with command %s" % (cmd))
#start the process
output = ""
process = Popen(shlex.split(cmd), stdout= PIPE, stderr= STDOUT)
stderr = process.communicate()[1]
class FeeManager(QtCore.QObject):
def copyAndVerify(self):
self.__fee = Fee(self, self.options)
self.connect(self.__fee, QtCore.SIGNAL("finished()"), self._setCopyFinished)
self.connect(self.__fee, QtCore.SIGNAL("progressUpdated(QString, int, QString)"), self._setCopyProgress)
devicename = self.device.blockdevice
self.__image_outputfilename = "output_file.img")
self.__fee.copy(devicename, self.__image_outputfilename)
class FeeWizardPage(QtGui.QWizardPage):
def initializePage(self):
#already earlier in another wizard page is the following: self.feemanager = FeeManager(self, info)
self.connect(self.wizard().feemanager, QtCore.SIGNAL("copyProgressUpdated(QString, int, QString)"), self.updateCopyProgress)
self.connect(self.wizard().feemanager, QtCore.SIGNAL("verifyProgressUpdated(QString, int, QString)"), self.updateVerifyProgress)
self.connect(self.wizard().feemanager, QtCore.SIGNAL("finished(PyQt_PyObject)"), self.setDone)
self.wizard().feemanager.copyAndVerify()
我做错了什么?我怎样才能避免这个信息,并希望给程序带来一些稳定性。我搜索过互联网和这个论坛,虽然我尝试过为其他人提供一些建议,但没有一个能解决这个问题。即使我注释掉所有信号和连接,我仍然会收到相同的警告消息
有人能帮忙吗
非常感谢。有人有什么想法吗?有人吗?