Results 1 to 4 of 4

Thread: Pre app.exec() behavior question

  1. #1
    Join Date
    Aug 2007
    Posts
    29
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Pre app.exec() behavior question

    In my main, before I call app.exec() I try to automate a call to http. If in the call, I add a QMessageBox:: then it executes properly, but if I don't then it doesn't follow through.

    example:
    int main(int argc, char *argv[])
    {
    MainWindow win();
    win.checksomething();
    app.exec();
    }

    void MainWindow::checksomething()
    {
    progressDialog->setWindowTitle(tr("Checking Something"));
    progressDialog->show();
    uhttp->setHost("localhost");
    httpGetRequest = true;
    downloadGetRequest = true;
    QString xmlFile = "XML.xml";
    httpGetId = uhttp->get(xmlFile);
    progressDialog->setLabelText(tr("Reading %1.").arg(xmlFile));
    QMessageBox::information(NULL, "update check", "Checking for Updates");
    //If I don't have the QMessageBox above, then this never gets downloaded
    }

    Any ideas why this happens?

    Thanks,
    Sean

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Pre app.exec() behavior question

    QHttp needs a running event loop.

  3. #3
    Join Date
    Aug 2007
    Posts
    29
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Pre app.exec() behavior question

    And calling QMessageBox starts that?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Pre app.exec() behavior question

    Quote Originally Posted by sgmurphy19 View Post
    And calling QMessageBox starts that?
    Yes, modal dialogs start a local event loop.

  5. The following user says thank you to jacek for this useful post:

    sgmurphy19 (16th September 2008)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.