I'm using a QProgressDialog with the limits (0, 0) to show something during a sqlite query and preparing the results to show. The QProgressDialog window stays in blank all the time, not matter if the process took 1 second or minute. My code is something like:
dialog.setLabelText("Updating");
dialog.setMinimun(0)
dialog.setMaximum(0);
dialog.show();
try
{
// here I call a function that executes a sql query to a sqlite database and then updates the whole interface with the result.
dialog.accept();
}
{
QMessageBox::critical(this,
"Error - " + qApp
->applicationName
(), e
);
qApp->exit(1);
}
QProgressDialog dialog(this);
dialog.setLabelText("Updating");
dialog.setMinimun(0)
dialog.setMaximum(0);
dialog.show();
try
{
// here I call a function that executes a sql query to a sqlite database and then updates the whole interface with the result.
dialog.accept();
}
catch (QString e)
{
QMessageBox::critical(this, "Error - " + qApp->applicationName(), e);
qApp->exit(1);
}
To copy to clipboard, switch view to plain text mode
Reading other post I have seen that in cases of a long during process is better to use another thread instead of the main one. It's this correct? Can I block the program during the process so the user can't interact with it when using another thread?
Bookmarks