---- On Mon, 18 Apr 2016 09:40:12 -0400 Scott Aron Bloom <sc...@towel42.com> 
wrote ---- 
 > The forum had a great thread on this
 > 
 > https://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") but it only makes the type 
available via the declarative components.  It also requires the object be a 
QObject which means sharing pointers.  There is also a problem inside of the 
Javascript.  It is very cumbersome to dynamically create these types.  I 
understand I am fighting QML, but my design is not as declarative as it is 
creating objects that can be passed back into C++.   I may be missing something 
though.

As an example below with a type called MyStruct:

... Qt Script...

var myStruct = new MyStruct();
myStruct.x = 10;

 ....QML...

var myStruct;
var component = Qt.createComponent(???);
 if (component.status == Component.Ready) {
        myStruct = component.createObject(parent, {"x": 100, "y": 100});
}
  
What would ??? be?

Thanks!

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to