Dialog Window closed befor reaching to done(Accepted);



  • Hey 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 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


  • Lifetime Qt Champion

    Hi,

    Is downloadFile blocking ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.