I am using QJson to serialize a QObject-derived class. I am able to serialize the class itself without any problems, but when it comes to one of its members, I am having a bit of trouble.
The class is named CProject and it contains a property files which is defined as:
QList<CProjectFile> files;
When serializing an instance of CProject, I get a message in the console:
QMetaProperty::read: Unable to handle unregistered datatype 'QList<CProjectFile>' for property 'CProject::files'
I read somewhere that I have to register the datatype, so I added the following after the declaration of CProject:
Q_DECLARE_METATYPE(QList<CProjectFile>)
...and when that did nothing, I added:
qRegisterMetaType< QList<CProjectFile> >();
Nothing is working. What am I doing wrong?