void CompanyWidget::setContact(int companyId, int contactId) { setCompany(companyId); int contactIndex = ui->contact->findData(contactId, PPLib::idRole); if (contactIndex < 0) { Contact *contact = new Contact(); if (!contact->retrive(contactId, false)) { delete contact; return; } ui->contact->model()->setData(QModelIndex(), (int) contact, PPLib::addRole); ui->contact->setCurrentIndex(ui->contact->count() - 1); return; } ui->contact->setCurrentIndex(contactIndex); }
MusicSoftware::MusicSoftware(unsigned year,string company) :AppSoftware(){ setYear(year), setCompany(company); ++_MSaliveObj; }