I am calling QProgressDialog from a thread and am unable to make it as a modal window even though I set the setModal to true. I want mainwindow to be blocked when QProgressDialog is in action.
following is my piece of code.
GenericFunc.h
QProgressDialog *progressBarDialog;
GenericFunc.cpp
void GenericFunc::testSlot()
{
int numTasks = 4500;
progressBarDialog = new QProgressDialog("Task in progress.", "Cancel", 0, numTasks);
progressBarDialog->setWindowModality(Qt::WindowModal);
progressBarDialog->setModal(true);
progressBarDialog->exec();
}