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
0
votes
1 answer

How do I exit a Qt script if a condition is met?

I want to do something like if(x == 0){ quit() ; } is there a way to do this in a Qt Script?
0
votes
2 answers

How to get current line number in Qt Script code?

Is there a way to obtain current line number in executing Qt Script, using objects and functions in it?
Sacha_D
  • 68
  • 1
  • 10
0
votes
2 answers

how to expose a QVariantHash variable to QtScript?

I know I can use below way to expose QStringList to QtScript, but how can I expose a QVariantHash? QStringList l; l<<"2"; QScriptValue v = qScriptValueFromSequence(&engine, l); engine.globalObject().setProperty("v", v);
zhongzhu
  • 307
  • 2
  • 4
  • 14
0
votes
1 answer

QScriptEngineAgent and QtScriptDebugger

I've been traying to make some implementation using QtScript and QScriptDebugger, but I wonder if ayone have information regarding the following topic. When using the function attachTo() of QtScriptDebugger, in the documentation it says that it set…
Qnoobish
  • 148
  • 11
0
votes
1 answer

How to Disconnect all connected in QtScript

I use QtScript in my application. Scripts are written by users. As example script like this: // function testIteration() { if () { …
Sacha_D
  • 68
  • 1
  • 10
0
votes
1 answer

Setting up a Proxy QScriptEngineAgent for script monitoring

I am using the QScriptEngine and QScriptEngineDebugger and I was reading the documentation of the QScriptEngine and I saw the following: “void QScriptEngineDebugger::attachTo ( QScriptEngine * engine ) Attaches to the given engine. The debugger…
Qnoobish
  • 148
  • 11
0
votes
1 answer

Add class to QScriptEngine

Here is an example of how I add instances of a class to my QScriptEngine: void Window::runCurrentScript(QRect rect) { Rectangle *script_mouse = new Rectangle(rect.normalized()); QScriptEngine engine; QScriptValue o2 =…
user336063
0
votes
1 answer

Parse HTML with QtScript?

Here's the scenario, I use QtNetwork module to retrieve a html page from internet, In the old days, I just create a new QWebPage object, and use the setHtml() function to load it, and parse it (find specific tags and attributes), but that looked…
daisy
  • 22,498
  • 29
  • 129
  • 265
0
votes
2 answers

Can’t access public slots from QtScript

I have this class: class JavaScript : public QObject { Q_OBJECT public: JavaScript(); bool executeFromFile(QString file); bool enabled; public slots: void setEnabled( bool enabled ); …
jviotti
  • 17,881
  • 26
  • 89
  • 148
0
votes
1 answer

QtScript Javascript Object loses property

I create a QScriptEngine and set a QObject as global object that has some signals / slots. Then I load some script files and pass it to the engine (using evaluate). The script creates an object and connects some signals of the global object to the…
Ben
  • 934
  • 2
  • 8
  • 11
0
votes
1 answer

Exposing a QStringList as a QtScript array

I have some QtScripts that need to operate on some C++ data. I already expose a number of variables via QScriptEngine::globalObject().setProperty(), but this only seems to work out of the box for simple data types and QStrings. I've tried using…
Chris
  • 17,119
  • 5
  • 57
  • 60
1 2 3 4 5 6 7
8