[Qt-interest] Scripting support for Qt/C++ application
Bo Thorsen
bo at fioniasoftware.dk
Mon Oct 31 08:55:36 CET 2011
Den 31-10-2011 02:33, Syam Krishnan skrev:
>
> Hi..
>
> I'm using Qt 4.5 on RHEL 5 to develop a dynamic data simulator
> application. I need scripting support to allow the user to easily
> manipulate the test cases.
> My first choice is of course Javascript (ECMAScript) that comes bundled
> with Qt. I've been experimenting and from what I have seen so far, using
> Javascript with Qt is quite simple.
>
> I would like to know if this has any serious performance impact. I mean,
> when I invoke a script from C++, it'll typically call several methods of
> my Qt C++ classes. Is this going to be reasonably fast or is it a highly
> inefficient process. I know I'm not quoting any real performance numbers
> here, but I want to know if this is a grossly OK thing to do.
>
> My other choices would be to use SWIG to interface with Python. I don't
> really know how easy or fast that is. It's just something I found when
> searching on the internet for scripting support for C++ applications.
>
> Note that I'd like to use Qt 4.5 itself if it can be helped.
>
> Any help/suggestions are highly appreciated.
I have implemented scripting with both QtScript and Python, and I
haven't seen much difference between those two. Performance isn't great
with either of them, but I don't think I have ever seen truly great
performance when scripting with general purpose languages.
Language wise, I prefer Python over Javascript. I think it's superior in
almost every way I can think of. And I will never agree that Javascript
(or ECMAscript, if you prefer) was a better choice. I told the original
author of QtScript this already :)
However, unless you have very good reasons to choose something else, go
with QtScript. It just makes your life easier on so many different
levels than if you try to incorporate a different language. It's better
integrated with QObject, and deployment is a non-issue. And it gives you
a path towards QtQuick, even though you might not find this important yet.
So even though I don't like the language much, I still say you should go
with QtScript.
Bo Thorsen,
Fionia Software.
--
Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk
More information about the Qt-interest-old
mailing list