Just a thought:

Looking at the documentation for setQuery, it states that the query must be active, and must not be isForwardOnly().

void QSqlQueryModel::setQuery ( const QSqlQuery & query )
Resets the model and sets the data provider to be the given query. Note that the query must be active and must not be isForwardOnly().
Which database are you using?

/ Ingemar