我刚刚在Kqjson图书馆玩.,发现“未明确提及”错误。 这是法典:
#include <qjson/qobjecthelper.h>
#include <qjson/serializer.h>
class Person: public QObject {
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(Gender gender READ gender WRITE setGender)
Q_ENUMS(Gender)
public:
Person(QObject *parent = 0);
~Person();
QString name() const;
void setName(const QString &name);
enum Gender{Male, Female};
Gender gender() const;
void setGender(Gender gender);
private:
QString m_name;
Gender m_gender;
};
int main ()
{
Person person;
QJson::Serializer serializer;
person.setName("Nick");
person.setGender(Person::Male);
QVariantMap person_map = QJson::QObjectHelper::qobject2qvariant(&person);
QByteArray json = serializer.serialize(person_map);
return 0;
}
因此,汇编者说,<代码>未明确提及个人:Person和等所有其他职能。 为什么?