[Interest] Replacement for Qt Script

Ian Geiser geiseri at geekcentral.pub
Thu Apr 21 20:53:09 CEST 2016




 ---- On Thu, 21 Apr 2016 05:21:43 -0400 Ben Lau <xbenlau at gmail.com> wrote ---- 
 > 
 > 
 > On 18 April 2016 at 23:38, Ian Geiser <geiseri at geekcentral.pub> wrote:
 >  ---- On Mon, 18 Apr 2016 11:06:59 -0400 Jason H <jhihn at gmx.com> wrote ----
 >  > ttps://forum.qt.io/topic/52306/qt-5-5-qt-script-deprecated-what-is-replacement/12
 >  > >
 >  > > I saw this thread, but it did not seem to offer a clear detail other than to use QJSEngine and QJSValue directly.  Specifically I use qScriptRegisterMetaType very heavy to add custom types.  I know if I am using QML I can use qmlRegisterType<T>(uri, 1, 0, "T")
 [...]
 > 
 > Suggestion
 > 1. Register a singleton QML component by C++.
 > 2. The C++ component provides hook function  (callback in Javascript) registration. 
 > void MyAPI::registerHook(QJSValue callback) {}
 > 3. Whatever an event occur, call the hook function.
 > QJSValueList args;QJSValue ret = callback.call(args);
 > 
 
Nice.  I will give this a spin.  I think this will work to convert the current API into QML.




More information about the Interest mailing list