topher
22nd February 2011, 07:55
I have a QMainWindow that has a QTableView as its central widget.
The main window itself is exposed to script engine:
QScriptValue winValue = engine->newQObject(mainWin);
engine->globalObject().setProperty("mainWindow", winValue);
Then, in my script, I try to find this child QTableView and call its public slot:
var view = mainWindow.findChild("tableView"); // The object name of QTableView is tableView
view.selectAll();
My question is:
If the script engine is run in a different thread, then are the script functions such as findChild() and selectAll() thread-safe? How is this implemented in QScriptEngine internally?
There once was "QObject::connect: Cannot queue arguments of type 'QItemSelection'" error while evaluating "view.selectAll()". However, it disappears after I insert "qRegisterMetaType<QItemSelection>("QItemSelection")" to the code.
The script does run as expected but I'm wondering if the error is actually solved or just hidden...:confused:
The main window itself is exposed to script engine:
QScriptValue winValue = engine->newQObject(mainWin);
engine->globalObject().setProperty("mainWindow", winValue);
Then, in my script, I try to find this child QTableView and call its public slot:
var view = mainWindow.findChild("tableView"); // The object name of QTableView is tableView
view.selectAll();
My question is:
If the script engine is run in a different thread, then are the script functions such as findChild() and selectAll() thread-safe? How is this implemented in QScriptEngine internally?
There once was "QObject::connect: Cannot queue arguments of type 'QItemSelection'" error while evaluating "view.selectAll()". However, it disappears after I insert "qRegisterMetaType<QItemSelection>("QItemSelection")" to the code.
The script does run as expected but I'm wondering if the error is actually solved or just hidden...:confused: