Questions tagged [qtscript]

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.

Documentation can be found here (Qt4) and here (Qt5).

116 questions
4
votes
2 answers

How to use c++ std complex numbers in QtScript

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…
FFox
  • 1,550
  • 2
  • 17
  • 26
4
votes
3 answers

STL operator= behavior change with Visual Studio 2010?

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…
guesser
  • 672
  • 6
  • 11
4
votes
1 answer

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, crashes if compiled with 64-bit Qt. Maybe it's an error in my code? Or Qt is not…
grigoryvp
  • 40,413
  • 64
  • 174
  • 277
4
votes
2 answers

Stop the evaluation of a Qt Script

I've recently add a script function on a simulator. I've add a "Launch Script" button on the GUI, who is able to launch the evaluation of a script. My main creates a QThread (scriptThread) who evaluate my script. My QMainWindows send signals to my…
MokaT
  • 1,416
  • 16
  • 37
4
votes
3 answers

QtScript: how to reload current script?

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…
grigoryvp
  • 40,413
  • 64
  • 174
  • 277
3
votes
2 answers

Problems with QScript

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) …
Guido
  • 41
  • 2
3
votes
1 answer

How to emulate a shell-like scripting environment with QTextEdit?

[Goal] A simple shell prompt with QTextEdit, or any other appropriate Qt ways. (Using QScriptEngine as an ECMA script interpreter is assumed) [Example] MATLAB Python In a shell prompt, the command line part is editable while the other parts are…
Tay2510
  • 5,748
  • 7
  • 39
  • 58
3
votes
0 answers

How do I generate documentation screenshots for a Qt application?

Without manual intervention I would like to generate screenshots of a Qt desktop application. The screenshots should be generated when the make documentation make target is being issued. So in the source tree there are no PNG files containing…
Erik Sjölund
  • 10,690
  • 7
  • 46
  • 74
3
votes
0 answers

Getting "destroyed" signal in Qt Script

How to properly connect to QObject's destroyed signal from Qt Script? When I connect to it like to your average signal, it does not work. I did test that I removed the object and that other QObjects did get the signal, but the script function I…
Xilexio
  • 1,178
  • 19
  • 40
3
votes
6 answers

Define tabs background with stylesheets without changing QWidget?

I want to make a very basic GUI: tabs, text area. But I want to color my tabs and make them always looking the same on MAC, Windows and Linux. So, I tryed to use a stylesheet: QTabWidget::pane { border-top: 2px solid #1B1B1B; …
MARTIN Damien
  • 996
  • 2
  • 15
  • 36
3
votes
1 answer

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);
codeincarnate
  • 845
  • 7
  • 13
2
votes
2 answers

QtScript plus enums

I am adding QScript to my Qt application. I have already added metadata and use some of the metadata functions to interrogate through C++ code. That works fine - I can navigate the object heirarchy and print out values (including enums). But, I…
ftkalcevic
  • 41
  • 4
2
votes
2 answers

How to make normal public methods available in QtScript

In my Qt application, all controls of a dialog are accessible to scripts using QtScript. To do this I use the newQObject method of QScriptEngine, like: QScriptValue btn = scriptEngine->newQObject(okBtn,…
grast
  • 21
  • 2
2
votes
3 answers

Namespacing QScriptEngine extensions

Could someone explain to me how to get namespacing in the QScriptEngine extensions? I've set it up so I have a directory foo/ under script/, with an __init__.js file being executed. __setupPackage__(__extension__); print(__extension__); hello =…
voodoogiant
  • 2,118
  • 6
  • 29
  • 49
2
votes
2 answers

Qt Installer Framework: TypeError cannot read property name

I tried creating an installer following the tutorial. I then added a script called "installerscript.qs" as per the startmenu example in the Qt Installer Framework directory. The "installscript.qs" is as…
Matthijs990
  • 637
  • 3
  • 26