Hi, I'm new to Qt4. I'm using Qt4.5

I use QSqlRelationalTableModel to show in a table view a database table with foreign keys to other tables. This works fine.
I created a form to edit each table row. I used a mapper and connected table selection model signal to setCurrentModelIndex mapper slot, this is the code

Qt Code:
  1. model = new QSqlRelationalTableModel(this, database);
  2. model->setTable("centros_programas");
  3. model->setRelation(1, QSqlRelation("provincias", "id_provincias", "nombre"));
  4.  
  5. model->setEditStrategy(QSqlTableModel::OnManualSubmit);
  6. model->select();
  7.  
  8. model->setHeaderData(0, Qt::Horizontal, QObject::tr("Id"));
  9. model->setHeaderData(1, Qt::Horizontal, QObject::tr("Provincia"));
  10. model->setHeaderData(2, Qt::Horizontal, QObject::tr("Centro/Programa"));
  11. model->setHeaderData(3, Qt::Horizontal, QObject::tr("Tipo"));
  12.  
  13. ui->comboBoxProvincia->setModel(model->relationModel(1) );
  14. ui->comboBoxProvincia->setModelColumn(model->relationModel(1)->fieldIndex("nombre"));
  15.  
  16. ui->table->setModel(model);
  17. ui->table->setColumnHidden(0, true);
  18.  
  19. mapper = new QDataWidgetMapper(this);
  20. mapper->setModel(model);
  21. mapper->addMapping(ui->comboBoxProvincia, model->fieldIndex("id_provincias") );
  22. mapper->addMapping(ui->lineEditCentro, model->fieldIndex("nombre") );
  23. mapper->addMapping(ui->lineEditTipo, model->fieldIndex("tipo") );
  24.  
  25. mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
  26.  
  27. connect(ui->table->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), mapper, SLOT(setCurrentModelIndex(QModelIndex)));
To copy to clipboard, switch view to plain text mode 

the thing is: in the form for editing each row, I have a combo box with data from a related table, as you can see in this line:

Qt Code:
  1. ui->comboBoxProvincia->setModel(model->relationModel(1) );
To copy to clipboard, switch view to plain text mode 

I didn't create another model for the combo box.
When I see it running it fills correctly the combo box, but it is not synchronized with data, it always shows first row of the related table.
I was searching and it seems that I need a delegate for it. This is right? I will need a delegate for each combo box? What if I have two or more combo boxes in the form?
Thanks in advance