void ScientistComputerConnectionsRepository::populateScientistList(std::list<Scientist> &scientistList, QSqlQuery query) { while(query.next()){ Scientist s = Scientist(); s.setId(query.value("ID").toInt()); s.setName(query.value("Name").toString().toStdString()); s.setDateOfBirth(query.value("DateOfBirth").toString().toStdString()); s.setDateOfDeath(query.value("DateOfDeath").toString().toStdString()); s.setGender(query.value("Gender").toInt()); scientistList.push_back(s); } }
void View::populateScientist(Scientist& guy){ string name; bool gender; QString fact; askName(name); askGender(gender); QDate doB = askDateOfBirth(); QDate doD = askDateOfDeath(); askFact(fact); guy.setName(QString::fromStdString(name)); guy.setGender(gender); guy.setdoB(doB); guy.setdoD(doD); guy.setFact(fact); return; }