Priority: P2: Important
Affects Version/s: 5.2.0 Alpha
Fix Version/s: None
Environment:Linux 3.8.0-31-generic #46-Ubuntu SMP Tue Sep 10 20:03:44 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
I have Qt 5.1.1 and Qt 5.2 on my machine and 5.2 is causing an assert failure in QQmlMetaObject::canConvert whereas 5.1.1 works fine. I’ve tracked it down to an instance where I’m assigning a derived class to a property that takes the interface class. I do have a work around which is to pass in QObject and use qobject_cast.
Onto the code. Qml is straightforward:
Property causing the issue is in FreeCameraControl:
Class Gui::Renderer did have Q_DECLARE_INTERFACE(Gui::Renderer, “net.shadowpsi.engine.Renderer”) and
Viewer::ViewRender had Q_INTERFACES(Gui::Renderer) but I’ve since discovered it makes no difference if I remove these in 5.1.1.
In QQmlPropertyPrivate::write the code goes into the property.isQObject branch. In here it calls this line
QQmlMetaObject propMo = rawMetaObjectForType(enginePriv, propertyType);
and propMo.isNull() ends up being true causing the assert to fail.
Just for reference I do have another section where I’m using derived classes from a non abstract class and this works fine which is why I’m leaning towards the problem being the interface or interface with namespace.