I do that with my model
Qt Code:
  1. QSqlQueryModel * model = new QSqlQueryModel(0);
  2. model->setQuery("select ......");
To copy to clipboard, switch view to plain text mode