Results 1 to 3 of 3

Thread: close all messageboxes

  1. #1
    Join Date
    Nov 2013
    Posts
    10
    Thanks
    8
    Platforms
    MacOS X Unix/X11 Windows Android

    Default close all messageboxes

    Hi all,

    My gui application opens different message boxes in different forms. I set parent to these message boxes as parent form. Created all messageboxes with QMessagebox::question(...). When I delete parent form (widget), It's throwing exception. If I change to NULL as a parent for message box, it's working fine.

    Now, I want to close all message boxes before deleting widget (parent form).

    Is there any qt api to close all opened message boxes in application?

    Thanks.

  2. #2
    Join Date
    Sep 2013
    Posts
    40
    Thanks
    6
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: close all messageboxes

    Hi,
    You can directly set the dialog as modal in ui, that will not allow any parent to get closed before its child window.

    Regards,
    Rohit

    DON'T WALK IN THE WORLD AS IF YOU RULE THE WORLD , WALK AS IF SOMEONE RULES AND YOU DON'T CARE.....

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: close all messageboxes

    Quote Originally Posted by av2306 View Post
    Is there any qt api to close all opened message boxes in application?
    Not specifically for QMessageBox, but you could probably us QObject::findChildren<QMessageBox*>() on your parent and then loop over the list and call close() on each.

    Maybe together with delayed deletion of the parent using deleteLater().

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 3rd October 2012, 20:48
  2. midi child does not close when I call close()
    By qlands in forum Qt Programming
    Replies: 7
    Last Post: 29th July 2011, 22:25
  3. QT application not close after close the mainwindow
    By artome in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2011, 22:23
  4. Replies: 2
    Last Post: 6th May 2011, 08:02
  5. Replies: 2
    Last Post: 17th December 2010, 19:01

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.