PDA

View Full Version : problem with qsqltablemodel



ditsikts
29th October 2011, 16:08
when tru to run, give this error: C2664: 'QSqlTableModel::QSqlTableModel(QSqlTableModelPriv ate &,QObject *,QSqlDatabase)' : cannot convert parameter 1 from 'QSqlTableModel *' to 'QSqlTableModelPrivate &'

QSqlTableModel *model = new QSqlTableModel();
model->setHeaderData(0,Qt::Horizontal,"name");
model->setHeaderData(1,Qt::Horizontal,"Date");
model->setHeaderData(2,Qt::Horizontal,"id");
model->setTable( "workmoneydata" );
model->setFilter( QString("name= %s").arg(name) );
model->select();

return model;

norobro
30th October 2011, 22:34
The function's signature is:
QSqlTableModel getwmData(QString name);And you're returning a pointer (QSqlTableModel *).