[Solved] Dialog show is does not happen immediately
-
I have a sever client application and in the beginning client loads data from server. I have a dialog showing status of getting data from server (has progress bar). But when I call the function the dialog appears with no contents in it with white background and suddenly changes to completed status.
@void SystemScreen::loadServerData()
{
qDebug() << Q_FUNC_INFO << "Invoked";if (NULL != mpDataManagerDlg) { qDebug() << Q_FUNC_INFO << "show progres screen"; mpDataManagerDlg->showScreen(); } loadData(); qDebug() << Q_FUNC_INFO << "Exits";
}
void SystemScreen::loadData()
{
qDebug() << Q_FUNC_INFO << "Invoked";if (NULL != mpDataManager) { mpDataManager->loadDataFromServer(); } qDebug() << Q_FUNC_INFO << "Exits";
}@
I feel that dialog is displayed only after loadData() function is completed. Is there any alternative to do this?
I used a timer to start @QTimer::singleShot(100, this, SLOT(loadData()));@ But then I have some trouble in getting data. ie data is empty if I read suddenly.
-
Hi,
Try to put
@
qApp->processEvent();
@Somewhere in your code, i had the same problem with my progress bar and this line works for me.
-
Thanks .. it works