QVariant 引发的 Q_DECLARE_METATYPE

2020-12-11  本文已影响0人  XBruce

error: C2338: Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system

QVariant setValue的时候,如果把一个枚举类型直接赋值,会出现上述错误。
static_cast<int>转换后OK。

上一篇 下一篇

猜你喜欢

热点阅读