Re: [PyQt] pyqtSlot, getting undefined return values when called from qml javascript
On Sun, Apr 29, 2012 at 5:47 PM, Phil Thompson p...@riverbankcomputing.com wrote: I have tried passing return value in the decorator (return=int...). Any clues where to look? Have you got a complete test that demonstrates the problem? Now I do, but when I went about to create that minimal example it started working ;-). So, thanks and sorry about the noise. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyqtSlot, getting undefined return values when called from qml javascript
On Sat, 28 Apr 2012 00:57:47 +0300, Ville M. Vainio vivai...@gmail.com wrote: I have a qml file invoking methods on a QObject subclass. I have used @pyqtSlot decorator to expose the methods as slots. I can see that the methods are run; however, the return values seem to be discarded. Code for the QObject subclass (that I expose with setContextProperty) is like this: === from PyQt4 import QtCore from PyQt4.QtCore import QObject,pyqtSlot class NodeWrapper(QObject): def __init__(self, c,v): QObject.__init__(self) self.c = c self.v = v @pyqtSlot() def get_b(self): return 2 #return self.v.b @pyqtSlot() def get_h(self): return self.v.h @pyqtSlot() def children(self): #self.all = all = [NodeWrapper(self.c, chi) for chi in self.v.children] all = hello print Will ret,all return all === I have tried passing return value in the decorator (return=int...). Any clues where to look? Have you got a complete test that demonstrates the problem? Phil ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyqtSlot, getting undefined return values when called from qml javascript
On Sat, Apr 28, 2012 at 1:10 AM, Andrew Suffield asuffi...@suffields.me.uk wrote: I have a qml file invoking methods on a QObject subclass. I have used @pyqtSlot decorator to expose the methods as slots. I can see that the methods are run; however, the return values seem to be discarded. Qt slots don't return anything... On PySide, they do: http://www.pyside.org/docs/pyside/PySide/QtCore/Slot.html Also, the pyQtSlot decorator has return argument to specify return value type: http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/new_style_signals_slots.html#PyQt4.QtCore.pyqtSlot ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[PyQt] pyqtSlot, getting undefined return values when called from qml javascript
I have a qml file invoking methods on a QObject subclass. I have used @pyqtSlot decorator to expose the methods as slots. I can see that the methods are run; however, the return values seem to be discarded. Code for the QObject subclass (that I expose with setContextProperty) is like this: === from PyQt4 import QtCore from PyQt4.QtCore import QObject,pyqtSlot class NodeWrapper(QObject): def __init__(self, c,v): QObject.__init__(self) self.c = c self.v = v @pyqtSlot() def get_b(self): return 2 #return self.v.b @pyqtSlot() def get_h(self): return self.v.h @pyqtSlot() def children(self): #self.all = all = [NodeWrapper(self.c, chi) for chi in self.v.children] all = hello print Will ret,all return all === I have tried passing return value in the decorator (return=int...). Any clues where to look? pyqt version is 4.9.1-2ubuntu1, on Ubuntu precise pangolin. ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Re: [PyQt] pyqtSlot, getting undefined return values when called from qml javascript
On Sat, Apr 28, 2012 at 12:57:47AM +0300, Ville M. Vainio wrote: I have a qml file invoking methods on a QObject subclass. I have used @pyqtSlot decorator to expose the methods as slots. I can see that the methods are run; however, the return values seem to be discarded. Qt slots don't return anything... ___ PyQt mailing listPyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt