QObject::connect: Cannot queue arguments of type 'QVector<int>'
正在阻止
dataChanged
捕获的信号。这是因为这个信号是从另一个(pythonic)线程发出的。为了使其工作,我需要对QThead进行子类化,如:
class MyThread(QThread):
updated = QtCore.pyqtSignal(str)
def run(self):
while 1:
result= do stuff...
self.updated.emit(result)
QAbstractTableModel
,将信号连接到我的型号:
class TableModel(QAbstractTableModel):
def __init__(self, rowCount: int, colCount: int, parent=None):
super(QAbstractTableModel, self).__init__(parent)
self._listenerth = MyThread()
self._listenerth.updated.connect(self.remote_update_handler)
self._listenerth.start(QThread.LowPriority)
def remote_update_handler(self,result):
self.setData(QModelIndex,result, QtCore.Qt.EditRole)