相关文章推荐
玉树临风的香菜  ·  About Azure Bastion ...·  1 周前    · 
豪气的大葱  ·  Azure AD Connect on ...·  1 周前    · 
打盹的大熊猫  ·  java 调用python ...·  1 年前    · 
..... 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.
  •