[Qt-interest] Returning a QObjectList from a slot in a QScriptable/QObject derived object?
Bastian Bense
bastibense at gmail.com
Thu Oct 15 21:50:12 CEST 2009
Hello all,
I'm experimenting a bit with QtScript and I was wondering why the following
is not working:
The Qt documentation states that there is a default conversion of types from
C++ to QtScript and vice versa.
>From what I read this seems to be true for slots declared in objects that
derive from QObject and QScriptable. While the slots work fine as long they
return some standard values like int, QString and so on, this does not seem
to be true for slots that return a QObjectList.
In the documentation it says that there is a default conversion to a
QtScript array with all objects in the array being converted by
newQObject().
Here is some example code:
class CpsJob :
public QObject,
public QScriptable
{
Q_OBJECT
public:
CpsJob();
public slots:
QObjectList testObjects();
};
As you can see there is a public slot called testObjects(). If I call this
slot from the script, I get an exception that tells me to register the type
using qScriptRegisterMetaType() first. Am I doing something obviously wrong?
Thanks in advance!
--
Best regards,
Bastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091015/a4624399/attachment.html
More information about the Qt-interest-old
mailing list