Results 1 to 10 of 10

Thread: close window but do not exit application

  1. #1
    Join Date
    Oct 2013
    Posts
    21
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default close window but do not exit application

    how to close window without close application

  2. #2
    Join Date
    Jul 2011
    Location
    Italy
    Posts
    24
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: close

    there is a way, but what would be the point?
    Is there another way to communicate with the application?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: close

    how to close window without close application
    Are you sure mean "close" and not "minimize"? Clicking the "X" at the top right of the window frame (in Windows, anyway) closes the window. If it is the application's main window, the application will exit. You can override this behavior by calling setQuitOnLastWindowClosed( false ) or by overriding the closeEvent() handler and calling ignore() on the event.

    But why would you want to do that? When a user clicks the "X", he expects the application to exit. You are trying to implement something that goes against the normal behavior that every other application follows.

    And like high_flyer says, if you do override this behavior, how will the use be able to exit the application? Will you force him to kill it with Task Manager?

  5. #5
    Join Date
    Oct 2013
    Posts
    21
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default setQuitOnLastwindowClosed()

    i used setQuitLastWindowClosed () function used but it shows the error like

    setQuitLastWindowClosed was not declare in the scope

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: setQuitOnLastwindowClosed()

    There is no function setQuitLastWindowClosed() in Qt.

    BTW: With your many years of Qt experience in multiple languages and on multiple platforms you should have absolutely no trouble sorting this out.

  7. The following user says thank you to ChrisW67 for this useful post:

    d_stranz (6th February 2014)

  8. #7
    Join Date
    Oct 2013
    Posts
    21
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default window

    i used calculator button on the LCD screen on bottom when touched calculator button it shows the calculator menu when again i touched calculator button main screen is closed or LCD screen off
    but i want only calculator application close without close LCD screen or main application

  9. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: window

    Can I be the first to say, "Huh?"
    If this is somehow related to your other threads then add it to those threads, don't start another.

  10. #9
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: setQuitOnLastwindowClosed()

    setQuitLastWindowClosed was not declare in the scope
    Maybe learning how to use QtAssistant would help you figure out that the method is really called QApplication::setQuitOnLastWindowClosed() (QGuiApplication in Qt 5).

  11. #10
    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: setQuitOnLastwindowClosed()

    Merged the threads and fixed the title

    Cheers,
    _

  12. The following user says thank you to anda_skoa for this useful post:

    d_stranz (6th February 2014)

Similar Threads

  1. Replies: 3
    Last Post: 26th May 2011, 13:29
  2. How to close (exit) a dialog properly
    By cooper in forum Newbie
    Replies: 6
    Last Post: 9th March 2011, 19:19
  3. Replies: 2
    Last Post: 17th December 2010, 19:01
  4. close application window
    By seltra in forum Newbie
    Replies: 5
    Last Post: 8th October 2010, 19:12
  5. Replies: 11
    Last Post: 15th July 2008, 13:11

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.