[Interest] C++ to QML export: "Cannot assign object to list"

Ingo Schiller Ingo_Schiller at raykiel.com
Fri Apr 15 11:10:05 CEST 2016

Dear all,

I am currently moving from Qt4.8,1 to Qt5.5.0 and I am facing a serious 
problem with the elements I am exporting from C++ to QML. It (still) uses 
the old way using QDeclarativeItem to export the UI elements to QML. At 
the moment I can't use QtQuick2 because part of the application heavily 
relies on QGraphicsView and worse: QGraphicsScene. So I still have to 
stick with the QDeclarative stuff which should still work with Qt5.5.

I am doing everything as with Qt4.8.1 that is: creating the UI elements as 
QDeclarativeItems in C++ and register them in QML with qmlRegisterType< >. 
Everything is compiled nicely and the import statement in the QML files 
don't show errors. I can start the application and all pure qml elements 
are rendered and do what they are supposed to do.

BUT: The elements exported from C++ can not be created. It is always 
states that "Cannot assign object to list" in the line in which such an 
element is created. I found a blog entry from Lewis Manor (
) in which he describes the same error message and found that a 
qRegisterMetaData<QObject*>("foo") destroyed the MetaSystem. So I searched 
for any similar error but could not find one. I even disabled all 
qRegisterMetaData and qmlRegisterType stuff except the one element I want 
to create. Still the same issue.

Can anyone help please??

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160415/ad534122/attachment.html>

More information about the Interest mailing list