void CompanyWidget::updateInfo() { int index = ui->company->currentIndex(); if (index < 0) { return; } Company *company = (Company *) ui->company->itemData(index, PPLib::entityRole).toInt(); Money credit = company->fields["company_credit"]; ui->creditCustomer->setText(credit.toString()); Money debt = company->fields["company_debt"]; ui->debtCustomer->setText(debt.toString()); }
void CompanyWidget::on_company_currentIndexChanged(int index) { if (index < 0) { return; } Company *company = (Company *) ui->company->itemData(index, PPLib::entityRole).toInt(); if (!ui->contactFrame->isHidden()) { contactF->setMatchValue(company->getId()); } if (!ui->finFrame->isHidden()){ Money credit = company->fields["company_credit"]; ui->creditCustomer->setText(credit.toString()); Money debt = company->fields["company_debt"]; ui->debtCustomer->setText(debt.toString()); } emit companyChanged(company); }