Hi,

instead of using QQmlMetaType::registerCustomStringConverter() you can add a static create() function that takes a QJSValue as argument to your class or have a ctor that takes QJSValue. Then register the type using QML_ANONYMOUS and it should be possible to create it from any JavaScript value assigned to it.

You can also do a number of interesting and nasty things to wrap the existing QMarginsF into a value type. Take a look at qquickvaluetypes_p.h in qtdeclarative for "inspiration".

The only thing shown there that you cannot do to your own value types is giving them names. The names passed to QML_VALUE_TYPE() are only decoration so far because the actual name resolution for value types is still hardcoded.

best regards,
Ulf
_______________________________________________
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to