[Qt-interest] QtScript, passing a var as a QString to a slot

Jaco Naude naude.jaco at gmail.com
Mon Mar 9 08:19:08 CET 2009


Hi Rohan, Alexandre

Thanks for your replies. Both ideas sounds good. The problem is that I want
to make "generic" functions. Functions that can be used in c++ code, Qt
Script and also future script backends (Like PythonQt for example.).

I guess I can create a function for each environment from where it is called
but I am hoping to have a more generic solution. The downside of having
different functions is that it will make usage more difficult. For example,
in Qt Script environment you would need to call the QtScript function, say
AddQt. In Python you would need to call AddPython or something like that. I
guess the use of auto completion will make it easier by presenting only
AddQt in QtScript environment, and AddPython in the Python environment. But
still the best solution will be to have only 1 function.

Thanks again, if there are any ways to do this, please let me know.
Jaco Naude

On Mon, Mar 9, 2009 at 1:45 AM, Rohan McGovern <rohan.mcgovern at nokia.com>wrote:

> On Friday 06 March 2009, ext Jaco Naude wrote:
> > 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);
> >
>
> Hi,
>
> You could consider rewriting these functions to return `void' and
> have them throw script exceptions on error.  The exception could
> contain whatever information is interesting to you.
>
> --
> Rohan McGovern
> Qt Software, Nokia
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090309/ceaa82ec/attachment.html 


More information about the Qt-interest-old mailing list