Results 1 to 8 of 8

Thread: Some errors if I don't click on QMessageBox button

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Some errors if I don't click on QMessageBox button

    A quick and dirty fix is to make installFile() a slot and in httpRequestFinished() invoke the slot with help of timer (to allow control to return to QHttp, where the signal was emitted from):
    Qt Code:
    1. if (error) {
    2. ...
    3. } else {
    4. //installFile();
    5. QTimer::singleShot(0, this, SLOT(installFile()));
    6. }
    7.  
    8. //delete file;
    9. //file = 0;
    To copy to clipboard, switch view to plain text mode 
    Notice also that you can't either delete the file here because you will later use it in installFile().
    J-P Nurmi

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Some errors if I don't click on QMessageBox button

    Yet another (easier and more elegant) way would be to simply force a queued connection:
    Qt Code:
    1. connect(http, SIGNAL(requestFinished(int, bool)),
    2. this, SLOT(httpRequestFinished(int, bool)), Qt::QueuedConnection);
    To copy to clipboard, switch view to plain text mode 
    In this case you wouldn't need modifications represented in my last message.
    J-P Nurmi

  3. The following 2 users say thank you to jpn for this useful post:

    jiveaxe (23rd January 2008), sgmurphy19 (3rd October 2008)

  4. #3
    Join Date
    Aug 2007
    Posts
    244
    Thanks
    42
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Some errors if I don't click on QMessageBox button

    Great code, jpn. Now the program runs very fine.

    A thousand thanks.
    Giuseppe CalÃ

Similar Threads

  1. Set up the Qt4.3.2 with Visual Studio 2005
    By lamoda in forum Installation and Deployment
    Replies: 6
    Last Post: 30th January 2008, 06:51
  2. QPaintEvent on button click?
    By vishal.chauhan in forum Qt Programming
    Replies: 1
    Last Post: 5th June 2007, 08:44
  3. change font size and button size of QMessageBox
    By nass in forum Qt Programming
    Replies: 6
    Last Post: 13th September 2006, 19:16
  4. get button on QMessageBox
    By manhds in forum Qt Programming
    Replies: 3
    Last Post: 27th June 2006, 04:38
  5. Push button double click
    By curtisw in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 16:40

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
  •  
Qt is a trademark of The Qt Company.