I use QtScript in my application. Scripts are written by users. As example script like this:
//<init test time counters>
function testIteration() {
if (<test time is out>) {
myCppObject.mySignalAllDone.disconnect(testIteration);//disconnection
return;
}
//<Adding actions to myCppObject>
}
myCppObject.mySignalAllDone.connect(testIteration);//connection
testIteration();
I want from C++ stop this script before test time passed and write function like this
void MainWindow::toolButtonStopScript_clicked(){
disconnect(&this->myCppObject);// Disconnecting everything connected to myCppObject.
this->scriptEngineThread.abortAllEvaluations();
myCppObject.stopAllActivity();// emits mySignalAllDone, that is not disconnected (why and how to do that if I don't know what connections user made?), calling testIteration(), appending activity to myCppObject and this ends only when test time passed. How to solve this?
this->guiLog.log(GUILog::log_info, tr("Execution of script is interrupted by user"), this->logLevelMsgs);
this->connectMyCppObject();//make default connections
}
How to disconnect properly?