我必须更新我的QTableWidget,但它有大量数据,所以我通过线程更新它:
self.vthread = visualThread(self.data_view, data)
self.vthread.start()
self.data_view
是一个QTableWidget,data
是一个类对象,它有一些我需要迭代并放入表中的列表属性。这是主题:
class visualThread(QThread):
def __init__(self, view, data):
QThread.__init__(self)
self.view = view
self.data= data
def __del__(self):
self.wait()
def run(self):
for y in range(len(self.data.axis[0])):
for x in range(len(self.data.axis[0])):
self.view.setItem(x, y, QTableWidgetItem(str(maintain_order_sort(self.data.data_array[x][y][::-1]))))
maintain_order_sort
只是重新组织字符串。
这是我的输出:
QObject::connect: Cannot queue arguments of type 'QVector<int>'
(Make sure 'QVector<int>' is registered using qRegisterMetaType().)
QObject::connect: Cannot queue arguments of type 'QVector<int>'
(Make sure 'QVector<int>' is registered using qRegisterMetaType().)
QObject::connect: Cannot queue arguments of type 'QVector<int>'
(Make sure 'QVector<int>' is registered using qRegisterMetaType().)
QObject::connect: Cannot queue arguments of type 'QVector<int>'
(Make sure 'QVector<int>' is registered using qRegisterMetaType().)
QObject::connect: Cannot queue arguments of type 'QVector<int>'
(Make sure 'QVector<int>' is registered using qRegisterMetaType().)
我尝试过添加信号(我有另一个可以处理信号的线程,这是唯一的错误),我已经将错误确定为setItem()
。 TIA