//把数据加载到tableView
voidImportData::loadDataInTableView()
{if (student_vec.size()>0)
{if (pageNum>student_vec.size())
{
pageNum=student_vec.size();
}else{
pageNum= 30;
}//qDebug()<< "student_vec size:" << student_vec.size() << " page num:" << pageNum;
student_model->clear();
setTableHeader();int k = 0;for (int k1 = (indexPage - 1)*pageNum; k1
{if (k1
{
Student studentIndex=student_vec.at(k1);
student_model->setItem(k, 0, newQStandardItem(QString::number(studentIndex.getID())));
student_model->setItem(k, 1, newQStandardItem(studentIndex.getName()));if (studentIndex.getSex() == "1")
{
student_model->setItem(k, 2, new QStandardItem(QString::fromLocal8Bit("女")));
}else{
student_model->setItem(k, 2, new QStandardItem(QString::fromLocal8Bit("男")));
}
student_model->setItem(k, 3, newQStandardItem(studentIndex.getBirthday()));
student_model->setItem(k, 4, newQStandardItem(QString::number(studentIndex.getWeight())));
student_model->setItem(k, 5, newQStandardItem(QString::number(studentIndex.getHeight())));
student_model->setItem(k, 6, newQStandardItem(studentIndex.getPhoneNum()));
student_model->setItem(k, 7, newQStandardItem(studentIndex.getAddress()));
student_model->setItem(k, 8, newQStandardItem(studentIndex.getSchoolName()));
student_model->setItem(k, 9, newQStandardItem(studentIndex.getSchoolType()));
student_model->setItem(k, 10, newQStandardItem(QString::number(studentIndex.getGradeNum())));
student_model->setItem(k, 11, newQStandardItem(QString::number(studentIndex.getClassNum())));
student_model->setItem(k, 12, newQStandardItem(studentIndex.getSID()));
student_model->setItem(k, 13, newQStandardItem(studentIndex.getIDCardNum()));
k++;
}
}
}
import_data_ui.tableView_list->setModel(student_model);
}