Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Dialog Window closed befor reaching to done(Accepted);
Forum Updated to NodeBB v4.3 + New Features

Dialog Window closed befor reaching to done(Accepted);

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 920 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Is downloadFile blocking ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved