QtScript is an ECMA262-compatible implementation of JavaScript. It is the successor of QSA (Qt Script For Applications), but is being phased out in recent Qt versions in favour of Google's V8 engine.
Questions tagged [qtscript]
116 questions
26
votes
1 answer
QtScript instanceof with custom class throws prototype-related error
I have a Qt project which uses the QtScript module to make some components of my application scriptable.
After several attempts at making the existing classes directly usable in QtScript, I chose to go with wrapper classes which inherit QObject and…

ixM
- 1,244
- 14
- 29
11
votes
1 answer
Debugging QJSEngine?
I have a project that provides a JS API for (long running) user scripts.
This project still uses the QtScript module which is kinda bugging me since the module is labeled deprecated for quite some time.
My problem is that i need the users to be…

ldr
- 211
- 1
- 11
11
votes
5 answers
What is the equivalent of JavaScript's setTimeout on qtScript?
Not much to add; what is the equivalent of JavaScript's setTimeout on qtScript?

MaiaVictor
- 51,090
- 44
- 144
- 286
10
votes
2 answers
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…

DaveO
- 1,909
- 4
- 33
- 63
8
votes
1 answer
Can I use should.js with QtScript?
I'm using QtScript to automate parts of my application for development and testing purposes. I've come to the point where I want to test assertions, and based on "standalone assertion libraries?" and what I could find in Debian repositories, I went…

Toby Speight
- 27,591
- 48
- 66
- 103
7
votes
2 answers
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…

Marko
- 30,263
- 18
- 74
- 108
7
votes
1 answer
QtScript vs QJSEngine when to use one or another?
I have to run a series of javascript 'scripts' in a C++ application. Most of them are repetitive actions. Example of code here.
I know Qt since version 5 contains 2 javascript engines: QtScript and QJSEngine.
My question is in which situations…

RandomGuy
- 648
- 6
- 21
6
votes
1 answer
Is there a way to maintain Qt script context environment outside of QScriptEngine#pushContext/popContext?
In Qt 4.8's scripting engine, "local" variables can be set by obtaining a QScriptContext from QScriptEngine::pushContext then setting the properties of its activation object. This can only be done within push/pop calls, since that's the only place a…

Jason C
- 38,729
- 14
- 126
- 182
6
votes
1 answer
Properties undefined only when accessed through script
I'm running into some strange behaviour where a property can be accessed directly through QObject's property function, but not through JavaScript:
#include
#include
#include
#include
class Item…

Mitch
- 23,716
- 9
- 83
- 122
6
votes
2 answers
How to profile QtScript Code?
I know there are tools to profile pure javascript code like firebug and Chrome's Developer Tools, but I want to know if there are any good tools for profiling QTScript. Or how can I use these tools to profile QtScript code.
The use case for this is…

Aamir Abro
- 838
- 12
- 24
5
votes
1 answer
Qt: Q_PROPERTY with pointer and forward declaration for QtScript access
Problem
I am making a project using Q_OBJECT and Q_PROPERTY to access some objects from scripts. I have two problems:
making classes that use forward declarations scriptable
returning a property as pointer
Explanations
1. Why forward…

opatut
- 6,708
- 5
- 32
- 37
5
votes
2 answers
Deep copy of a QScriptValue as Global Object
I have a program using QtScript for some automation. I have added a bunch of C++ functions and classes to the global scope of the script engine so that scripts can access them, like so:
QScriptValue fun = engine->newFunction( systemFunc…

Dave Ceddia
- 1,480
- 2
- 17
- 24
5
votes
2 answers
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…

Alexander Kondratskiy
- 4,156
- 2
- 30
- 51
4
votes
2 answers
QtScript output redirection
When I call this code:
QScriptEngine e;
e.evaluate("print('hello, world!')");
the output text (from print method) is written to main application's terminal.
Is there any way to redirect it to a custom QIODevice?

Arenim
- 4,097
- 3
- 21
- 31
4
votes
1 answer
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++…

FFox
- 1,550
- 2
- 17
- 26