PDA

View Full Version : Set default Selected item in ListView (QSqlQueryModel)



jeffpogo
26th May 2009, 23:12
Hi,

Please help with this simple question: (Thank you!)

How would set the default "selected" item on my ListView Widget where the company "no" column equals 4 in the Sql Model below?



QSqlQueryModel *model = new QSqlQueryModel;
model ->setQuery(
"SELECT no, name FROM company WHERE status = 'A' ORDER BY 1");
listView->setModel(model);
listView->setModelColumn(1);