typedef struct student_ { int sno; string sname; }student; //学生的结构 vector<student> data_vector data_vector.push_back(student); QByteArray binary_data; binary_data.resize(sizeof(student)*data_vector.size()); memcpy(binary_data.data(),(char*)&data_vector[0],sizeof(student)*data_vector.size()); //类对象数据的还原 student* data = (student*)binary_data.data();原文链接:https://www.f2er.com/sqlite/200387.html