标签:int com student import page etc for dex height
Qt tableview加载数据
//把数据加载到tableView void ImportData::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<indexPage*pageNum; k1++) { if (k1<student_vec.size()) { Student studentIndex = student_vec.at(k1); student_model->setItem(k, 0, new QStandardItem(QString::number(studentIndex.getID()))); student_model->setItem(k, 1, new QStandardItem(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, new QStandardItem(studentIndex.getBirthday())); student_model->setItem(k, 4, new QStandardItem(QString::number(studentIndex.getWeight()))); student_model->setItem(k, 5, new QStandardItem(QString::number(studentIndex.getHeight()))); student_model->setItem(k, 6, new QStandardItem(studentIndex.getPhoneNum())); student_model->setItem(k, 7, new QStandardItem(studentIndex.getAddress())); student_model->setItem(k, 8, new QStandardItem(studentIndex.getSchoolName())); student_model->setItem(k, 9, new QStandardItem(studentIndex.getSchoolType())); student_model->setItem(k, 10, new QStandardItem(QString::number(studentIndex.getGradeNum()))); student_model->setItem(k, 11, new QStandardItem(QString::number(studentIndex.getClassNum()))); student_model->setItem(k, 12, new QStandardItem(studentIndex.getSID())); student_model->setItem(k, 13, new QStandardItem(studentIndex.getIDCardNum())); k++; } } } import_data_ui.tableView_list->setModel(student_model); }
标签:int com student import page etc for dex height
原文地址:https://www.cnblogs.com/herd/p/11739850.html