I want to use QMetaObject :: invokeMethod to call an object method (it will later be run in another thread, and then the invokeMethod method will be called). I am using Qt 4.8 PySide 1.2.1 bindings on Python 3.3. Full example:
from PySide import QtCore class Tester(QtCore.QObject): def __init__(self): super().__init__() def beep(self): print('beep') if __name__ == '__main__': t = Tester() QtCore.QMetaObject.invokeMethod(t, 'beep', QtCore.Qt.AutoConnection)
And the result:
QMetaObject::invokeMethod: No such method Tester::beep()
while I was expecting a beep . This method has not been called.
So what happened? It seems so simple that I cannot find a mistake.
edit: I got it to work using the `@QtCore.Slot 'decoration in this method. Thanks for the comment and response.
source share