Hello, I am currently working on a database application that has two threads - the query thread and the gui thread. The data is sent from query thread to gui thread in form of QSqlQueryModel*. Everything works fine and the application is operational but still I would like to have my QSqlQueryModel *model protected so that only one thread at a time can use it. In the gui thread I have the following piece of code:
ui.tableView->setModel(model);
ui.tableView->setColumnWidth(0, 50);
ui.tableView->setColumnWidth(1, 250);
ui.tableView->setColumnWidth(2, 250);
ui.tableView->setColumnWidth(3, 100);
ui.tableView->show();
ui.tableView->setModel(model);
ui.tableView->setColumnWidth(0, 50);
ui.tableView->setColumnWidth(1, 250);
ui.tableView->setColumnWidth(2, 250);
ui.tableView->setColumnWidth(3, 100);
ui.tableView->show();
To copy to clipboard, switch view to plain text mode
In the query thread I have the following code:
model->setQuery(*query);
model->setQuery(*query);
To copy to clipboard, switch view to plain text mode
How could I achieve the following: When one piece of code starts the other would not get executed until the first one has finished.
Thanks in advance for any help you offer.
Bookmarks