I use QSqlRelationalTableModel to show data. It does not show any data if I uncomment
// mpCustomerModel->setRelation(18, QSqlRelation("CountryMaster", "code", "name"));
in the below code. Is there something wrong?
mpCustomerModel = new QSqlRelationalTableModel(this);
mpCountryModel = new QSqlTableModel(this);
if (NULL != mpCustomerModel)
{
mpCustomerModel->setTable("CustomerMaster");
mpCustomerModel->setRelation(15, QSqlRelation("CountryMaster", "code", "name"));
//mpCustomerModel->setRelation(18, QSqlRelation("CountryMaster", "code", "name"));
mpCustomerModel->select();
ui->customerComboBox->setModel(mpCustomerModel);
ui->customerComboBox->setModelColumn(1);
Aucun commentaire:
Enregistrer un commentaire