Reputation: 30885
I have something that is strange , I have Dialog window that I trigger from MainWIndow like this:
//this is from main window
DialogUpdateContainer dialogUpdateContainer(this);
dialogUpdateContainer.getFileName(m_new_version_name);
if(dialogUpdateContainer.exec() == QDialog::Accepted )
{
return true;
}
And in the DialogUpdateContainer
I have this simple code :
DialogUpdateContainer::DialogUpdateContainer( QWidget *parent) : QDialog(parent),
ui(new Ui::DialogUpdate)
{
ui->setupUi( this );
pHttpDownloadManager = new HttpDownloadManager();
connect(ui->buttonBox,
SIGNAL(accepted()),
this,
SLOT(OkSettingsHandler()));
connect(ui->buttonBox,
SIGNAL(rejected()),
this,
SLOT(CancelSettingsHandler()));
}
void DialogUpdateContainer::getFileName(QString& fileNameToDownload)
{
fileToDownload = fileNameToDownload;
}
void DialogUpdateContainer::OkSettingsHandler()
{
if(pHttpDownloadManager->downloadFile(fileToDownload))
{
done(Accepted);
}
}
void DialogUpdateContainer::CancelSettingsHandler()
{
done(Rejected);
}
Now the problem is when I click the ok in the dialog windows its closing immediately without waiting for pHttpDownloadManager->downloadFile(fileToDownload&);
to finish
its even never gets to the done(Accepted);
Why ?
I want it to wait to until it done the function and only then to close.
Upvotes: 1
Views: 53
Reputation: 3049
Very odd:
if(dialogUpdateContainer.exec() == QDialog::Accepted ) {
return true;
}
Normal:
if(dialogUpdateContainer.exec()==QDialog::Accepted ) {
return true;
}
Upvotes: 1