Hi,
supplying a QVariant property containing a custom type towards QML does not
work (even if it is registered as a metatype).
Currently I am explicitly converting the custom type to something QML
understands, like:
if (variant.canConvert<MyCustomType1>()) {
MyCustomType1 t = variant.value<MyCustomType1>();
//stream as QVariantMap
} else if (variant.canConvert<MyCustomType2>() {
MyCustomType2 t = variant.value<MyCustomType2>();
//stream as QVariantMap
} …
Is there a conversion method available that makes it possible to
‘automagically’ convert the custom type to a type suitable for QML?
Something like: MyCustomType1::toQmlType() …
Or can I use one of the QMetaType::registerConverter() to define a conversion
from a POCO to a QML type?
Note: the custom types are currently only containing data; so, no methods need
to be proxied or marshalled to QML.
Cheers,
Kurt
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development