Skip to content

Instantly share code, notes, and snippets.

@codeyash
Created May 1, 2011 04:48
Show Gist options
  • Save codeyash/950259 to your computer and use it in GitHub Desktop.
Save codeyash/950259 to your computer and use it in GitHub Desktop.
QSqlTableModel to query db
// Qt: Use QSqlTableModel to query db
model = new QSqlTableModel(this);
model->setTable("properties");
model->setFilter (QString("property LIKE \'%1%\'").arg(searchedString));
model->setSort (1,Qt::AscendingOrder);
model->select();
model->removeColumn (0);
qDebug ()<< model->query ().lastQuery ();
qDebug () << customQueryModel->query ().lastQuery (); //grab last query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment