I means that one thread query the database ,other UI thread retrive the records and show in the window.
I use QSqlQueryModel object set the query, a QTableView object show the records,after finish query, call the QTableView's setModel function, the result show correctly.
however ,if the query take too much time,the user can not wait for such a long time.
the fellowing is part of my code
m_pQryModel = new QSqlQueryModel;
m_pTblView = new QTableView(this);
//someother codes
QString szSQL=tr("SELECT XXX ......");
m_pQryModel->setQuery(szSQL);
if(m_pQryModel->lastError().isValid())
{
AlarmBox(m_pQryModel->lastError().text().toAscii().data());
return false;
}
m_pTblView->setModel(m_pQryModel);
//...