trikRuntime
trikScriptRunner::ScriptThread Class Reference

Thread object which executes a script with a QScriptEngine. More...

#include <scriptThread.h>

Inheritance diagram for trikScriptRunner::ScriptThread:
Collaboration diagram for trikScriptRunner::ScriptThread:

Public Slots

void onGetVariables (const QString &propertyName)
 Catch variables values from current script execution. More...
 

Signals

void stopRunning ()
 Emitted when event loop must be stopped. More...
 
void variablesReady (const QJsonObject &json)
 Emitted when variables values are ready. More...
 

Public Member Functions

 ScriptThread (Threading &threading, const QString &id, QScriptEngine *engine, const QString &script)
 Constructor. More...
 
 ~ScriptThread () override
 
void abort ()
 Aborts execution. Asynchronous: a thread will not be finished on return from this function. More...
 
QString id () const
 
QString error () const
 
bool isEvaluating () const
 

Protected Member Functions

void run () override
 

Detailed Description

Thread object which executes a script with a QScriptEngine.

Constructor & Destructor Documentation

ScriptThread::ScriptThread ( Threading threading,
const QString &  id,
QScriptEngine *  engine,
const QString &  script 
)

Constructor.

Parameters
threading- threading manager for this thread
engine- QScriptEngine which will do the work
script- a Qt Script to run
ScriptThread::~ScriptThread ( )
override

Member Function Documentation

void ScriptThread::abort ( )

Aborts execution. Asynchronous: a thread will not be finished on return from this function.

QString ScriptThread::error ( ) const
Returns
error message or empty string if evalutation succeed
QString ScriptThread::id ( ) const
Returns
string id of the thread
bool ScriptThread::isEvaluating ( ) const
Returns
true if the script engine is evaluating a script at the moment
void ScriptThread::onGetVariables ( const QString &  propertyName)
slot

Catch variables values from current script execution.

Parameters
propertyName- name of variables prefix, i.e prefix "web" for variable "web.light"
void ScriptThread::run ( )
overrideprotected
void trikScriptRunner::ScriptThread::stopRunning ( )
signal

Emitted when event loop must be stopped.

void trikScriptRunner::ScriptThread::variablesReady ( const QJsonObject &  json)
signal

Emitted when variables values are ready.

Parameters
json- JSON container for variables values

The documentation for this class was generated from the following files: