Results 1 to 14 of 14

Thread: Just launch QMessageBox and then continue with following code?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2011
    Location
    Netherlands
    Posts
    17
    Thanks
    4
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Just launch QMessageBox and then continue with following code?

    You won't have a memory leak if you set the attribute such that the object is deleted once the messagebox is closed. You can do this by setting:

    Qt Code:
    1. msgBox->setAttribute(Qt::WA_DeleteOnClose);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Talking Re: Just launch QMessageBox and then continue with following code?

    Hey, thank you all. It finally worked. This is what I did:
    Qt Code:
    1. QMessageBox *msgBox1 = new QMessageBox;
    2. //here button declarations
    3. msgBox1->setWindowModality(Qt::NonModal);
    4. QCoreApplication::processEvents();
    5. msgBox1->show();
    6. QCoreApplication::processEvents();
    To copy to clipboard, switch view to plain text mode 
    Thank you all
    On last problem:
    After this first "Please Wait" button, I want to close it and open the next one, which informs the user about update or not. The thing is, that when I call
    if(msgbox->isEnabled())
    msgbox->close();
    it just deletes all the "widgets" of the msgBox and it let it empty. What should I call?

    EDIT:
    I was wrong, the msgBox when is shown IS EMPTY (nothing is shown, even if I have call setText() )
    When another button is shown and I call msgbox->close(), the text is shown for 0.00001 secs and then it disappears, as it should...
    What's wrong?
    Last edited by hakermania; 23rd January 2011 at 11:39.
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  3. #3
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Just launch QMessageBox and then continue with following code?

    Well, I've placed everywhere qApp->processEvents(); and I have
    msgBox1->setAttribute(Qt::WA_DeleteOnClose);
    msgBox1->setWindowModality(Qt::NonModal);

    but now, sometimes it does show up normally, sometimes it is too slow and it only updates when it is to close to show the next messagebox...Quite weird.... ANy other who want to help me a bit? I think I am close....
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

Similar Threads

  1. Replies: 6
    Last Post: 26th April 2010, 16:47
  2. I cannot launch my app!
    By MIH1406 in forum Qt Tools
    Replies: 9
    Last Post: 26th October 2009, 11:53
  3. Qt nmake error - can I continue with build?
    By QPlace in forum Installation and Deployment
    Replies: 0
    Last Post: 7th April 2009, 18:18
  4. launch app
    By damien in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2009, 19:42
  5. How to wait 2 seconds before continue
    By raphaelf in forum Newbie
    Replies: 3
    Last Post: 25th June 2008, 14:36

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.