mardi 9 juin 2015

Qt Creator and Sqlite-view model on Combobox

What makes this code incompatible with my QSqlRelational model on Sqlite db:

parInd = model->fieldIndex("stPar");
model->setRelation(parInd, QSqlRelation("allParents", "parID", "parName"));
QSqlTableModel *parModel = model->relationModel(parInd);
ui->stParent->setModel(parModel);
ui->stParent->setModelColumn(parModel->fieldIndex("parName"));

The 'allParents' is a view and the column 'parName' adds two columns("parname1||' '||parname2") on the sqlite database ...the code was working with MS SQL Server on the same view. When the form is opened, all comboboxes displays with their foreign key values using the default QSqlDelegate but then leaves all lineEdits null. The "moveNext" buttons shows that the *mapper *navigates between the rows. What is causing this?

Thanks in Advance

Aucun commentaire:

Enregistrer un commentaire