1

I want to send Qt script data into another thread. To do that, I must copy the data, since the QScriptValue objects refer to javascript objects, rather than containing them.

How can I clone a function? This isn't very good, cloning entry into subEntry:

subEntry = target.engine()->evaluate("("+entry.toString()+")");
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
  • What do you mean by "this isn't very good"? What do you wish to improve? To make it any better, you'd need to implement function cloning in the `QtScript` module's code itself. I.e. you need to patch Qt. – Kuba hasn't forgotten Monica Sep 01 '17 at 18:21
  • @KubaOber well, the above fails for native functions for example. It also doesn't clone the function's captured scope, but I guess I *could* live without that. But if there's any binding to an object (`Function.prototype.bind`) that won't work either. – Tomáš Zato Sep 01 '17 at 19:56
  • This requires a Qt patch. Any chance you could do use the modern `QJSEngine`? It'd be easier to implement there AFAICT. – Kuba hasn't forgotten Monica Sep 05 '17 at 15:43

0 Answers0