qtscript

Creating GUI application completely in QtScript, what is your opinion?

Since QT license change is announced I started to take a look at the QT framework. It looks nice, but I don't like having to use C++. I know there are different bindings for various languages, but QtScript seems most interesting to me. Is it possible to use QtScript to code complete GUI application (with help from UI designer, of course...

Qt: Add UI Elements using Qt Script

Is it possible to add new GUI elements into a Qt program using QtScript? For instance assuming the variable "layout" is a vertical layout would this be acceptable? var label = new QLabel("Text"); layout.addWidget(label); ...

Can you implement lazy array access in QtScript?

Is it possible to implement a QObject for use in QtScript which overloads [] to implement lazy array population? I want to implement something like this: var bar = foo["bar"]; and have the value be lazily calculated in C++ code. Is this possible? ...

Any decent QtScript tutorial?

Hello everyone. Is there any good QtScript tutorial that isn't about slots or accessing c++ values from script? All I need is one function in external file that uses some regexps on array values and then sends output back to main programm. I understand, that it can be done using signals/slots, but it looks like overhead and I'm sure the...

QtScript: how to reload current script?

Hello. QScriptEngine has evaluate() method that can be used to load script, execute it and to run a specified function from already loaded script. But how to clear current script and load a new one? For example, i use evaluate() to load a script from file and then evaluate() to get a script functions and call them. But what can i do to ...

QtScript: crash on 64-bit windows.

I have compiled Qt for 64-bit architecture under windows and all works fine except QtScript. The following simple code, working perfectly with 32-bit Qt for windows installed from qtsoftware.com, crashes if compiled with 64-bit Qt . Maybe it's an error in my code? Or Qt is not compatible with 64-bit? Or something else? Any comments are w...

May one create an open source scripting application using QtScript?

Hi there, I'd like to implement my own script engine using the QtScript component and other Qt components. Since this should be an open source (GPL) application I thought I would be free to do this. But now I found a page at Qt's website that made me doubtful about it: What are the restrictions with releasing scriptable application...

Accessing not Non-QObject-based objects from Qt Script

Is there any nice and simple way to access non QObject-based classes, such as QXmlQuery, QDateTime etc. from Qt Script? The only way I see is to wrap QXmlQuery in another class that inherits QObject and declare as slot every function which I need to access from Qt Script: void MyXmlQuery::setQuery ( const QString & sourceCode, const QU...

QtScript: Passing an array of objects to C++

Hi, I want to pass an array of objects from my QtScript to C++ but I have not been able to figure out how to achieve this. As soon as I create an array, the elements inside it are converted to strings before I can access them. This is what I have been trying so far: class myObject : public QObject, public QScriptable { Q_OBJECT ...

Functions connected to signals in QtScript (on Qt 4.5.2) are not firing

I've injected into a proprietary Qt (4.5.2) application, added my own compatible build of QtScript, and have managed to get access to all the signals I need. However, when connecting to them (via QtScript) my functions are never called. I've come up with a few theories for why this is and I've tested everything I can think of, but I've...

STL operator= behavior change with Visual Studio 2010?

Hi, I am attempting to compile QtScriptGenerator (gitorious) with Visual Studio 2010 (C++) and have run into a compile error. In searching for a solution, I have seen occasional references to compile breakages introduced since VS2008 due to changes in VS2010's implementation of STL and/or c++0x conformance changes. Any ideas what is h...

Using a member function with QScriptEngine::newFunction

Hey all, Let's take the case of a simple class: QScriptEngine engine; class MyClass { public: QScriptValue foo(QScriptContext*, QScriptEngine*); MyClass(); }; QScriptValue MyClass:foo(QScriptContext* context, QScriptEngine* eng) { //something } MyClass::MyClass() { QScriptValue self = engine.newFunction(this->foo, 0);...

How to use c++ std complex numbers in QtScript

Hello everyone, I try to find out how to use complex numbers in QtScripts such that slots defined with complex arguments can be called from a QtScript. Also basic algebra (+,-,exp, ... ) of complex-numbers should be accessible to the user from the script. Just for illustration want I want to call is: #include<complex> typedef complex<...

Is it possible to use custom c++ classes with overloaded operators in QtScript?

Does anyone know if it is possible to have a C++ class with overloaded operators such as +,-,* and declare it somehow (this is where the magic happens) to a QtScriptEngine such that js-expressions like "a+b" are evaluated as they would be on the C++ side? ...

How easy is Lua with Qt, compared to QtScript?

I'm just starting C++ development using Qt. However, I'm also interested in using Lua to script my app, given various articles stating its development speed (ease) for writing the workflow/ui/glue of an application. However, out of the box Qt doesn't support it, instead it includes QtScript. My question is basically should I attempt to ...

override operator with qtscript

I want do a math editor using qtscript. It will support array calculating in script. Such as array1 + array2 = array3.({1,2,3}+{3,4,5} = {4,6,8}); Maybe I need override operator+, I consult the example of QByteArray, and I override operator+,but when I execute in Script,it can't be invoke,anyone coule give me some suggestions? bytearr...

Problems with QScript

Hi guys, It’s all the day that I’m trying to make this code working. It should be the same code presented in the QScript help page but unfortunately it doesn’t work at all! class Person { public: QString nm; Person() { } Person(QString& name) :nm(name) { } }; Q_DECLARE_METATYPE(Person) Q_DECLARE_METATYPE(Person*) QScriptV...

Handling C++ exception thrown in function exported to QtScript.

I am using the Qt script engine in my application as an alternative way for the user to access its functionality. As such, I export some C++ classes to the Qt ScriptEngine, that will serve as the interface to the application. The problem is, these C++ classes can throw exceptions. I have a "ScriptInterface" class running on its own thr...

Error passing custom Object from QtScript to C++

Hello, I have written a custom class which is available in QtScript through a Prototype. Also another global class is available which should be used to print the custom class generated in QtScript. This is my custom class (very simple ;) ): class Message { public: int source; int target; }; This is the prototype I...

Chaining constructors in JavaScript

Hello! I'm trying to implement some kind of class hierarchy in JavaScript. I think I understood the prototype chain, but I still have to sort out the constructor-chaining. Following David Flanagan's Definitive Guide, I wrote function DerivedClass() { BaseClass.apply(this, arguments); // chain constructors // do some initializa...