QProgressDialog Cannot show its contents
-
Following code can perform progressbar in other functions but not this
@QProgressDialog *progressDlg = new QProgressDialog;
progressDlg->setWindowModality(Qt::WindowModal);
progressDlg->setModal(true);
progressDlg->show();
progressDlg->setWindowTitle("Loading...");
progressDlg->setRange(1, n);for(int i = 1; i <= n; ++i)
{
Taxi t;
char fileName[256];
sprintf(fileName, "%s%d%s", fileDir, i, ".txt");
progressDlg->setValue(i);
progressDlg->setLabelText(fileName);
t.readData(fileName);if(t.getId() != -1)
m_vTaxi.push_back(t);
}@ -
-
Hi and welcome to devnet,
Since your modifying QProgressDialog modality, I guess that the call to setValue doesn't call processEvents(), you'll have to do it in your loop.
Hope it helps
-
[quote author="SGaist" date="1375091635"]Hi and welcome to devnet,
Since your modifying QProgressDialog modality, I guess that the call to setValue doesn't call processEvents(), you'll have to do it in your loop.
Hope it helps[/quote]
Thanks a lot ! It really helps! -
You're welcome !
If this solves your problem, you can update the thread's title to solved so other forum users may know that a solution has been found :)