自定义结构体
struct tytemp
{
unsigned int target;
unsigned int current;
};
Q_DECLARE_METATYPE(tytemp)
/*将结构体变成QVariant*/
QVariant temp1;
tytemp info;
info.target = 90;
info.current = 100;
temp1 = QVariant::fromValue(info);
/*将QVariant变成结构体*/
tytemp tempinfo= temp1.value<tytemp>()