PDA

View Full Version : What's wrong with QxtSqlPackageModel



wirasto
12th December 2009, 05:59
I tried use QxtSqlPackageModel like this. But data not show in QTableView


QSqlQuery a;
a.exec("select * from anggota");

QxtSqlPackage sp;
sp.insert(a);

qDebug() << sp.count();


QxtSqlPackageModel model;
model.setQuery(sp);

ui->tableView->setModel(&model);

Lykurg
12th December 2009, 10:30
Likely it's because you don't create your model on the heap! It is destroyed after you leave the scope. (Unless your code is not in your main function.)

wirasto
12th December 2009, 11:38
You right. must create on the heap :)