Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QAxScriptManager and QAxScript problem when used inside a QThread's run() function
I've a simple VBScript code which I'm executing using QAxScriptManager and QAxScript in Windows.
The same exact VBScript returns an error complaining there is no such function in my VBScript file when I'm trying to execute it inside the thread's run() function.
Note that the script works when it is called from outside run() function, for example in thread's constructor.
Any idea why this happens?
I noticed that the cause of the problem is here, but still can't see why this is happening.
QAxScriptManager *scrMgr = new QAxScriptManager(this);
QAxScript *scrpt = scrMgr->load(":/Scr/SomeScr.vbs", "MyScr");
// QAxScriptManager failed to load the script!
QAxScriptManager::load() function returns 0 :(
Unfortunately not. He mentions the following code solved his problem.
QWidget *widget = new QWidget();
QAxScriptManager *m_manager = new QAxScriptManager(widget);
But I'm not allowed to create a widget inside a non-gui thread. Creating a QObject also didn't help!
I'm changing to QTimer for the time being, cause it also solves my problem but it wouldn't be a threaded application design the way I want it :(