尝试从QThread Works向QTableWidget添加项目但引发错误

时间:2017-10-20 02:19:04

标签: multithreading python-3.x pyqt5

我必须更新我的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

0 个答案:

没有答案