I have upgraded QT from 4.4.0 to the latest 4.4.3(of Nokia)

and the QDataWidgetMapper doesn't seem to work anymore!!

is anybody had similar pb??
or is it that my code is missing something which only work with the previous version?

I load the database to display a list in the table "ui.tableView_PL" (this still work and display the table).
and I use mapper to show some info into different labels. but nothing is display on these labals anymore.

It worked before the upgrade so I am a bit puzzled...

Qt Code:
  1. void mainwindow::loadProgamListFromDB(QString indexPL, bool addnewElement) {
  2.  
  3.  
  4. // loAD table
  5. QSqlQueryModel *modelFromSql = new QSqlQueryModel();
  6. QString sqlString =
  7. "SELECT id,name, capacity,duration, position FROM plandfile WHERE pl_id="
  8. + indexPL + " ORDER BY position";//ORDER BY id ASC ";
  9. modelFromSql->setQuery(sqlString);
  10. ui.tableView_PL->setModel(modelFromSql);
  11. modelFromSql->setHeaderData(0, Qt::Horizontal, QObject::tr("ID"));
  12. modelFromSql->setHeaderData(1, Qt::Horizontal, QObject::tr("Name"));
  13. modelFromSql->setHeaderData(2, Qt::Horizontal, QObject::tr("Capacity"));
  14. modelFromSql->setHeaderData(3, Qt::Horizontal, QObject::tr("Duration"));
  15. modelFromSql->setHeaderData(4, Qt::Horizontal, QObject::tr("Position"));
  16.  
  17. ui.tableView_PL->show();
  18.  
  19. int numberofvalues = modelFromSql->rowCount();
  20. if (addnewElement) {
  21. selectedRowIndex = (numberofvalues - 1);//row to be highlighted // when add Pause selected row should last row
  22. }
  23. ui.tableView_PL->selectRow(selectedRowIndex);//row to be highlighted
  24.  
  25. //sizes of the columns
  26. ui.tableView_PL->setColumnWidth(0, 40);//size for index
  27. ui.tableView_PL->setColumnWidth(1, 300);//size for name
  28. ui.tableView_PL->setColumnWidth(4, 50);//size for position
  29. ui.tableView_PL->hideColumn(4);//hide position column
  30. ui.tableView_PL->hideColumn(0);//hide index column
  31.  
  32. ui.tableView_PL->setFocus();
  33.  
  34. QString message=" numberofvalues: "+QString::number(numberofvalues,10)
  35. +" selectedRowIndex: "+QString::number(selectedRowIndex,10);
  36. QMessageBox::about(this, tr("numberofvalues"), message);// need <QtGui>
  37.  
  38. QDataWidgetMapper *mapper = new QDataWidgetMapper(this);
  39. mapper->setModel(modelFromSql);
  40. mapper->setItemDelegate(new QSqlRelationalDelegate(this));
  41. mapper->addMapping(ui.label_plandfileID, 0);//map label3 to the first column
  42. mapper->addMapping(ui.label_plandfileName, 1);
  43. mapper->addMapping(ui.label_position, 4);
  44.  
  45. mapper->setCurrentIndex(selectedRowIndex);
  46.  
  47. connect(ui.tableView_PL->selectionModel(), SIGNAL(currentRowChanged (QModelIndex,QModelIndex)), mapper, SLOT(setCurrentModelIndex(QModelIndex)));
  48. }
To copy to clipboard, switch view to plain text mode