Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QDeclarativeListProperty unregistered datatype error
kernco last edited by
I'm trying to use QDeclarativeListProperty so that in QML I can use a Repeater in a Column to create a QML Item for each object in a QList. I've just copied what was done in the Minehunt demo (http://qt-project.org/doc/qt-4.8/demos-declarative-minehunt.html ) and changed TileData to my own Element class, but when I try to run the program, I get this error:
@QMetaProperty::read: Unable to handle unregistered datatype 'QDeclarativeListProperty<Element>' for property 'Game::elements'@
I can't figure out why it's an unregistered datatype. I don't see anywhere in the Minehunt demo where anything is done to register their datatypes. What would cause this error? Both Game and Element inherit from QObject, just like TileData and MinehuntGame do in the demo.
chriadam last edited by
In "main.cpp":http://qt-project.org/doc/qt-4.8/demos-declarative-minehunt-main-cpp.html of the minehunt demo, it does register TileData as a QML object type. Although I'm not sure if that is what allows the QDeclarativeListProperty<TileData> to be registered automatically by the engine... QDLP has some quirks.