0

With Sq-lite, how can I set a model for the combo-box that has two table columns added together (ie surName +' '+ firstName)...with MS SQL Server I simply use a view.

When I tried with Sq Lite...nope! all other widgets (ie.QLineEdit and QDateEdits) loose their content and only combo-boxes display please Help!

Edit: Using QSqlRelationalModel the QWidgetDataMapper does not work on my form. All widgets are null except the comb-boxes using the default delegate

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 saved on my sqlite db When I change reference table to tblParents(the base table) all widgets are ok with data...the problem is the parent field displays only firstname yet I need the fullname. How can I work around this!

Kyef
  • 69
  • 7

0 Answers0