[SOLVED] using a QlistView to display the contents of a Sqlite Database
Hi all, i would like to use the QSqlQueryModel to interface between my QSqlDatabase and QListView. does anyone know how i would go about doing this?
db = QSqlDatabase::addDatabase("QSQLITE");
QSqlQuery query; query.exec("create table Players " "(id integer primary key, " "name varchar(20), " "path varchar(30))" ); query.exec("INSERT INTO Players (id, name, path)" "VALUES ('1', 'Tesco', 'C://tesco')"); query.exec("INSERT INTO Players (id, name, path)" "VALUES ('2', 'Tesco', 'C://tesco')"); model = new QSqlQueryModel; model->setQuery("SELECT name FROM Players"); playerView->setModel(model);
that is the code i have so far - it does create the table and it does insert the two records into it - it just does not display them!
thanks for any help / suggestions!