Results 1 to 4 of 4

Thread: closing dialog in hidden main Widget

  1. #1
    Join Date
    Jan 2006
    Posts
    122
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default closing dialog in hidden main Widget

    Hi all,
    I noticed a strange beahaviour when closing a modal dialog(but the same is for any kind of widget) child
    of a hidden main widget, what happens is that if the main widget is hidden and I close the modal dialog the application quit.
    This case occurs to me when my application is iconized in the tray icon, so it's hidden, and I close a custom "About" dialog,
    The problem doesn't happen if the main window is visible or shown minimized.

    Is there a way to bypass this behaviour?
    thanks in advance

    bye

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: closing dialog in hidden main Widget

    You experience that behaviour because by default QApplication quits when the last window is closed. To avoid that you need to call QApplication::setQuitOnLastWindowClosed(false).

  3. The following user says thank you to wysota for this useful post:

    Lele (6th December 2006)

  4. #3
    Join Date
    Jan 2006
    Posts
    122
    Thanks
    16
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: closing dialog in hidden main Widget

    thanks a lot, easier than I thought
    bye

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: closing dialog in hidden main Widget

    Just remember you'll have to call QCoreApplication::quit() yourself now.

Similar Threads

  1. accessing my main application window widget
    By jayw710 in forum Newbie
    Replies: 8
    Last Post: 15th November 2007, 19:33
  2. Previewing a stack widget dialog
    By mikeh in forum Qt Tools
    Replies: 4
    Last Post: 2nd October 2006, 10:19
  3. Replies: 3
    Last Post: 31st March 2006, 18:38
  4. Replies: 1
    Last Post: 15th February 2006, 22:17
  5. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52

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.