I ran into the same issue and ended up using QSqlQuery like this:
q = db.exec("SELECT a.ID, a.name, a.surname FROM addresses as a WHERE a.ID=" + your_id);
q.next();
thename = q.value(1).toString();
thesurname = q.value(2).toString();
QSqlQuery q;
q = db.exec("SELECT a.ID, a.name, a.surname FROM addresses as a WHERE a.ID=" + your_id);
q.next();
thename = q.value(1).toString();
thesurname = q.value(2).toString();
To copy to clipboard, switch view to plain text mode
I haven't tested this code, but I'm sure you get the idea.
The various sql models are great for certain scenarios but I find myself often using QSqlQuery in addition to the model, especially when the model is read-only.
hope this helps.
Bookmarks