I've found a solution, right now I'm using a QSqlQueryModel so I can combine some queries.
But now I have another problem(A)
Some code snippets:
mainWindow
::mainWindow(QWidget *parent
){ //create model
//setQueryCritics
this->setQueryCritics(orderModel, 1);
}
{
query.prepare("SELECT c.*, o.* FROM clients AS c, orders AS o WHERE o.oid = c.cid and o.currentStatus = :status ");
switch(type){
case 1 :
//orderModel
query.bindValue(":status", "1");
break;
case 2 :
//finishModel
query.bindValue(":status", "2");
break;
case 3 :
//trashModel
query.bindValue(":status", "3");
break;
case 4 :
//clientModel
query.prepare("SELECT * FROM clients");
break;
}
model.setQuery(query);
}
mainWindow::mainWindow(QWidget *parent){
//create model
QSqlQueryModel *orderModel = new QSqlQueryModel;
//setQueryCritics
this->setQueryCritics(orderModel, 1);
}
void mainWindow::setQueryCritics(QSqlQueryModel &model, int type)
{
QSqlQuery query;
query.prepare("SELECT c.*, o.* FROM clients AS c, orders AS o WHERE o.oid = c.cid and o.currentStatus = :status ");
switch(type){
case 1 :
//orderModel
query.bindValue(":status", "1");
break;
case 2 :
//finishModel
query.bindValue(":status", "2");
break;
case 3 :
//trashModel
query.bindValue(":status", "3");
break;
case 4 :
//clientModel
query.prepare("SELECT * FROM clients");
break;
}
model.setQuery(query);
}
To copy to clipboard, switch view to plain text mode
and here is the error message I get:
mainWindow.cpp:37: error: no matching function for call to 'mainWindow::setQueryCritics(QSqlQueryModel*&, int)'
I hope and I think it's a real simple problem, but I don't see the solution 
Can somebody help me with this?
Kind regards,
Cyberboy
Bookmarks