PDA

View Full Version : What's wrong with QxtSqlPackageModel



wirasto
12th December 2009, 06: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, 11: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, 12:38
You right. must create on the heap :)