From API docs:
Custom types registered using qRegisterMetaType() and qRegisterMetaTypeStreamOperators() can be stored using QSettings.
How can I do that? I get the error:
too few template-parameter-lists at
qRegisterMetaTypeStreamOperators
My code:
class LineUser {
public:
int uId;
QString passwd;
qint8 statusType;
};
Q_DECLARE_METATYPE(LineUser)
QDataStream &operator<<(QDataStream &out, const LineUser &myObj) {
out<<myObj.uId<<myObj.passwd<<myObj.statusType;
return out;
}
QDataStream &operator>>(QDataStream &in, LineUser &myObj) {
in>>myObj.uId>>myObj.passwd>>myObj.statusType;
return in;
}
qRegisterMetaTypeStreamOperators<LineUser>("LineUser");