Skip to content Skip to sidebar Skip to footer

Qobject::connect: Cannot Queue Arguments Of Type 'object' In Pyside

I am using PySide (Python Qt binding). I have a worker thread of class QThread that updates the main GUI thread (updates the QTableWidget) through signal/slot mechanism. In my work

Solution 1:

I guess I have found an answer myself, well not exactly an answer, but a workable solution.

I switched all the Signals to the new-style syntax. In case anyone is wondering, I did that by defining a custom signal in my worker class. So my code looks something like this

class Worker(QThread):

    alterTable = Signal(dict)

    def __init__(self, parent=None):
        ....
        self.alterTable.emit(parameters)


class GUI(QMainWindow):

    def __init__(self, parent=None):
        WorkerModule.Worker().alterTable.connect(self.myMethod)

For some reason the Signal has to be inside the QThread class; otherwise, Qt complains about "Signal has no attribute connect" error, which is very weird.


Solution 2:

Incredibly late for the answer here, my apologies. Not enough reputation to add a comment to your accepted answer. I hope this might help new PySide/Pyside2 users who stumble upon your issue.

Issue: QObject::connect: Cannot queue arguments of type 'object'

Answer : self.connect(self.worker, SIGNAL("alterTable(PyObject)"), self.updateMainTable, Qt.AutoConnection)

Issue: Qt complains about "Signal has no attribute connect" error

Solution: The connect attribute is implemented in QObject, so you must first call the parent's init method through either QMainWindow.__init__(self) or super(GUI, self).__init__() (Py2) or also super().__init__() (Py3).

Cheers.


Post a Comment for "Qobject::connect: Cannot Queue Arguments Of Type 'object' In Pyside"