添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
..... self.runBtn = QtWidgets.QPushButton(self.tab) self.runBtn.clicked.connect(self.func2) ...... def func1(self, text): self.tableWidget_2.setItem(row, 1 , QtWidgets.QTableWidgetItem(text)) def func2(self): ..... ..... t = threading.Thread(target=executer.execute_func, args=(self.func1)) t.setDaemon(True) t.start()
executer.py
def execute_func(dispFunc): connect() #another thread is created in this funcn ...... ...... text = " Something" dispFunc(row, text) On clicking the run button, when the func1 is called for displaying the text in the table widget, I am getting this error message:
QObject::connect: Cannot queue arguments of type ' QVector<int>' (Make sure ' QVector<int>' is registered using qRegisterMetaType().)
What I have tried:
class MyThread(QThread): change_value = pyqtSignal( int , str) def run(self): ..... def func2(self): self.thread = MyThread() self.thread.change_value.connect(self.func1) self.thread.start()
Please help
Quote:
Make sure ' QVector<int> ' is registered using qRegisterMetaType()
Try following the instructions in the error message.
QMetaType Class | Qt Core 5.15.2 [ ^ ]
  • Read the question carefully.
  • Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  • If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  • Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question. Let's work to help developers, not make them feel stupid.
  •