I am trying to set up a simple QProgressDialog while a for loop is taking place without using mutlithreading. I followed the Keeping the GUI Responsive but I cannot get it working:
QProgressDialog progress
("Copying files...",
"Abort Copy",
0, myModel
->model
->rowCount
(),
this);
progress.setWindowModality(Qt::WindowModal);
// progress.show();
for( int i = 0; i< linesetIndexes.size()-1; i++ )
{
progress.setValue(i);
if (progress.wasCanceled())
break;
......//proccessing
}
QProgressDialog progress("Copying files...", "Abort Copy", 0, myModel->model->rowCount(), this);
progress.setWindowModality(Qt::WindowModal);
// progress.show();
for( int i = 0; i< linesetIndexes.size()-1; i++ )
{
progress.setValue(i);
QCoreApplication::processEvents();
if (progress.wasCanceled())
break;
......//proccessing
}
To copy to clipboard, switch view to plain text mode
Bookmarks