Questions tagged [qjsengine]

Provides an environment for evaluating JavaScript code

The QJSEngine class provides an environment for evaluating JavaScript code

40 questions
0
votes
1 answer

How to register types like QList in QJSEngine?

I use scripting in my Qt-app with the QJSEngine. One of my C++ functions returns QList type, and I need to call it from javascript. It's called with no errors. However, it returns QVariant(QList) instead of expected list of…
Maximko
  • 627
  • 8
  • 20
0
votes
2 answers

How to clean up or destroy QJSEngine?

I'm putting together an application using Qt 5.12 where users will load JS scripts that interact with the app through its API. These scripts are bundled into "projects" (i.e multiple JS modules that depend on each other), and at any time I want only…
yah_nosh
  • 155
  • 1
  • 8
0
votes
1 answer

How do I get standard output from QJSEngine in Qt 5.12?

I enabled ConsoleExtension for debugging scripts by calling installExtensions. How can I capture the console output of QJSEngine?
Midiparse
  • 4,701
  • 7
  • 28
  • 48
0
votes
1 answer

Qt 5.11.2 (Clang 8.0 (Apple), 64 bit), QJSEngine file not found

I'm porting source from a project that was previous built with Qt 5.6, now I'm updating to 5.11 I get an error when trying to build the project: 'QJSEngine' file not found In my source: #include #include #include…
SPlatten
  • 5,334
  • 11
  • 57
  • 128
0
votes
0 answers

QJSEngine cause a crash at exit when having accessed to pointer to C++ object

I am trying to make part of my application scriptable. I have an object “GraphLogic” which contains a table of pointer on “Block” objects. I want to have access to this object in my script. #include #include class Block; class…
0
votes
0 answers

Transition from QtScript to QML/QJSEngine

There is some platform with use of QtScript as the JavaScript interpreter for the description of logic of the application. Example of a script on JS var f=new File('/var/www/test1'); f.write('123\n'); f.CopyTo('/var/www/test2'); Object of File is…
0
votes
1 answer

Accessing Qt API from JavaScript with QJSEngine

I'm using a QJSEngine to make an application scriptable. I'd like the JavaScript side to be able to modify the user interface. My main issue right now is accessing the Qt API from JavaScript. To create widgets, I added a createWidget() wrapper that…
isanae
  • 3,253
  • 1
  • 22
  • 47
0
votes
2 answers

QJSEngine: print to console

I'm moving from QScriptEngine (which is deprecated) to QJSEngine, and I see that I'm unable to use print: QJSEngine engine; QJSValue val = engine.evaluate( "print('123');" ); if (val.isError()){ qDebug() << "error: " <<…
Dmitry Frank
  • 10,417
  • 10
  • 64
  • 114
-1
votes
1 answer

QJSEngine won't evaluate js array correctly

I have a file settings.js which includes an array with arrays of settings: [ // [property, section, hex-address, Bytes to read/write, type, lsb, msb, options] ["AEC Control" , "AEC Control", 0x10300, 4, "bool", 0, 0], ["Shutter Mode",…
goulashsoup
  • 2,639
  • 2
  • 34
  • 60
-2
votes
2 answers

QJSEngine global string compare

I am using Qt 5.11.2, in my application I am using QJSEngine, in my example I have a script: function connect() { console.info("-----------"); if ( strFirstScan.localeCompare("true") == 0 ) { console.info("First…
SPlatten
  • 5,334
  • 11
  • 57
  • 128
1 2
3