必须重载运算符 != ,==(可能需要) ,因为编译成moc的时候会生成 !=的代码
例子:
class BaseType
{
public:
QVariant value = "";
QString name;
bool isShow = true;
bool ISPRIMARYKEY = false;
bool ISAUTOINCREMENT = false;
bool ISUNIQUE = false;
bool ISNULLABLE = false;
BaseType& operator = (const QVariant &t1) {
value = t1;
return *this;
}
bool operator==(const BaseType& other) const {
return this->value == other.value;
}
bool operator!=(const BaseType& other) const {
return !(this->value == other.value);
}
BaseType() {
}
};
Q_DECLARE_METATYPE(BaseDBType)