#pragma once
#include <QMetaType>
#include <QString>
class test_QMetaType
{
public:
test_QMetaType()
{
}
QString m_body = "AAAAAA";
};
Q_DECLARE_METATYPE(test_QMetaType);
void test_meta_type()
{
qRegisterMetaType<test_QMetaType>();
int id = QMetaType::type("test_QMetaType");
if (id != QMetaType::UnknownType)
{
void *myClassPtr = QMetaType::create(id);
test_QMetaType* a = static_cast<test_QMetaType*>(myClassPtr);
a->m_body = "ABC";
QMetaType::destroy(id, myClassPtr);
myClassPtr = 0;
}
}