[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] pyqtSlot, getting "undefined" return values when called from qml javascript
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2012-04-29 14:47:17
Message-ID: b2468aa97c0df11a2ad7fa0b8ad6c96e () localhost
[Download RAW message or body]
On Sat, 28 Apr 2012 00:57:47 +0300, "Ville M. Vainio" <vivainio@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 list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic