Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, April 2008
QDataWidgetMapper not writeable data


Message 1 in thread

I have a db table linked to the application using a 
QSqlRelationalTableModel because there are 2 foreignk key fields and a 
QDataWidgetMapper to map the form controls:

    SqlTblModel.setTable("T_Machine");
    SqlTblModel.setEditStrategy(QSqlRelationalTableModel::OnManualSubmit);
    int iMachineTypeIndex = SqlTblModel.fieldIndex("idMachineType");
    int iAttackTypeIndex = SqlTblModel.fieldIndex("idAttackType");
    // these are foreign keys between T_Machine and other tables
    SqlTblModel.setRelation(iMachineTypeIndex, 
QSqlRelation("T_MachineType","idMachineType","Description"));
    SqlTblModel.setRelation(iAttackTypeIndex, 
QSqlRelation("T_AttackType","idAttackType","Description"));
    SqlTblModel.select();
    // data fields to widget controls mapping
//    SqlDelegate = new QSqlRelationalDelegate(&Map);
    Map.setModel(&SqlTblModel);
    Map.setSubmitPolicy(QDataWidgetMapper::ManualSubmit);

apparently I am able to write data bat in practice the underlaying db 
table doesn't change so I think I am missing something.
Every help welcome.

begin:vcard
begin:vcard
fn:Massimo Manca
n:Manca;Massimo
org:Micron Engineering di Massimo Manca
adr:;;via della Ferriera, 48;Pordenone;PN;33170;ITALIA
email;internet:massimo.manca@xxxxxxxxxxxxxxxxxxxx
tel;work:+39 0434 1856131
tel;fax:+39 0434 1851032 / 178 273 3543
tel;cell:+39 349 4504979
url:http://www.micronengineering.it
version:2.1
end:vcard