[Qt-interest] QtScript, passing a var as a QString to a slot
Jaco Naude
naude.jaco at gmail.com
Fri Mar 6 12:35:17 CET 2009
Hi there
I hope that someone can point me in the right direction here. I'm new to
scripting with QtScript and I'm having some problems. I have the following
two slots:
*Q_INVOKABLE bool MatrixAdd(const QString& variable_to_add, const QString&
new_name);*
*Q_INVOKABLE bool MatrixSubtract(const QString& variable_to_subtract, const
QString& new_name, QString& result_string);*
I execute the following script and it works fine:
*var worked = a.MatrixAdd("b","d");*
But I want to return information about what went wrong if the function
returned false. Thus I execute the following:
*var result_string; *
*var worked = a.MatrixSubtract("b","c", result_string);*
and I get the following:
*Script Error: TypeError: cannot call MatrixSubtract(): argument 3 has
unknown type `QString&' (register the type with qScriptRegisterMetaType()) *
*1, TypeError: cannot call MatrixSubtract(): argument 3 has unknown type
`QString&' (register the type with qScriptRegisterMetaType())*
Should I rather make the result_string type a QScriptValue and convert this
to a string in my function? Or is there a way that I can leave the slot as
is and do something different in the code.
Thanks in advance,
Jaco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090306/331dd44e/attachment.html
More information about the Qt-interest-old
mailing list