I am struggling for few days now at what seems to be already answered, but i cant find answer for my situation
I am trying to create CRUD form
I have QSqlRelationalTableModel connected to QTableView
Qt Code:
  1. m_table->setTable(m_tableName);
  2. m_table->setJoinMode(QSqlRelationalTableModel::LeftJoin);
  3. m_table->select();
  4. ui->table->setModel(m_table);
To copy to clipboard, switch view to plain text mode 
the same model is connected to QDataWidgetMapper, and mapper is connected to qtableview selection model
Qt Code:
  1. mapper = new QDataWidgetMapper(this);
  2. mapper->setItemDelegate(new QSqlRelationalDelegate);
  3. mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
To copy to clipboard, switch view to plain text mode 
I create edit form with comboboxes dynamiclly for each field if there is relation
Qt Code:
  1. if(m_table->relationModel(fieldIndex)){
  2. QComboBox *cb = new QComboBox();
  3. cb->setModel(m_table->relationModel(fieldIndex));
  4. cb->setModelColumn(m_table->relationModel(fieldIndex)->fieldIndex("name"));
  5. mapper->addMapping(cb, fieldIndex);
  6. }
To copy to clipboard, switch view to plain text mode 
Whenn i try to edit record with
mapper->submit()
it returnes false, like there is error, but m_table->lastError() is empty, and data is submitted to database!?!?
The strangest thing is that after submit, the table (qtableview) shows key value instead of text value from relational table for submitted row, until i re-select model
What am i doing wrong?