I use QJson to serialize the QObject -derived class. I can serialize the class itself without any problems, but when it comes to one of its members, I have problems.
The class is named CProject and contains the files property, 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 need to register a data type, so after declaring CProject :
I added the following:
Q_DECLARE_METATYPE(QList<CProjectFile>)
... and when I did nothing, I added:
qRegisterMetaType< QList<CProjectFile> >();
Nothing works. What am I doing wrong?
source share