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);
QScriptValue winValue = engine->newQObject(mainWin);
engine->globalObject().setProperty("mainWindow", winValue);
To copy to clipboard, switch view to plain text mode
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();
var view = mainWindow.findChild("tableView"); // The object name of QTableView is tableView
view.selectAll();
To copy to clipboard, switch view to plain text mode
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...
Bookmarks