Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Quit in Windows
Qt 6.11 is out! See what's new in the release blog

Quit in Windows

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 5 Posters 2.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mgreenish
    wrote on last edited by
    #1

    I'm writing an application for Windows and OS X using QT Creator. QT or OS X automatically puts a quit menu item but not for Windows. If I add 'Quit' with shortcut Command-Q in 'File' menu of my main application form, then Quit stops working under OS X. Do I need to add the Quit menu item dynamically or is there a way to create it in the form such that it works for both Windows and OS X?

    raven-worxR JonBJ 2 Replies Last reply
    0
    • M mgreenish

      I'm writing an application for Windows and OS X using QT Creator. QT or OS X automatically puts a quit menu item but not for Windows. If I add 'Quit' with shortcut Command-Q in 'File' menu of my main application form, then Quit stops working under OS X. Do I need to add the Quit menu item dynamically or is there a way to create it in the form such that it works for both Windows and OS X?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @mgreenish
      just add it dynamically then:

      #ifndef Q_OS_MACOS
      menu->addAction( quitAction );
      #endif
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      M 1 Reply Last reply
      3
      • M mgreenish

        I'm writing an application for Windows and OS X using QT Creator. QT or OS X automatically puts a quit menu item but not for Windows. If I add 'Quit' with shortcut Command-Q in 'File' menu of my main application form, then Quit stops working under OS X. Do I need to add the Quit menu item dynamically or is there a way to create it in the form such that it works for both Windows and OS X?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @mgreenish
        Windows apps don't tend to have a Quit menu item. And personally I shudder when I see a Windows program with one!

        raven-worxR 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Please show how you are setting up your Quit action.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • raven-worxR raven-worx

            @mgreenish
            just add it dynamically then:

            #ifndef Q_OS_MACOS
            menu->addAction( quitAction );
            #endif
            
            M Offline
            M Offline
            mpergand
            wrote on last edited by
            #5

            @raven-worx said in Quit in Windows:

            @mgreenish
            just add it dynamically then:

            #ifndef Q_OS_MACOS
            menu->addAction( quitAction );
            #endif
            

            bad, bad !

            action=menu->addAction(tr("Exit"));
            action->setMenuRole(QAction::QuitRole);
            action->setShortcut(QKeySequence::Quit);
            

            should work well on all platforms.

            1 Reply Last reply
            0
            • JonBJ JonB

              @mgreenish
              Windows apps don't tend to have a Quit menu item. And personally I shudder when I see a Windows program with one!

              raven-worxR Offline
              raven-worxR Offline
              raven-worx
              Moderators
              wrote on last edited by
              #6

              @JonB said in Quit in Windows:

              Windows apps don't tend to have a Quit menu item. And personally I shudder when I see a Windows program with one!

              actually its the exact opposite IMO. Almost all application with a File-menu have one.

              @mpergand said in Quit in Windows:

              bad, bad !

              whats bad about it?!

              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
              If you have a question please use the forum so others can benefit from the solution in the future

              JonBJ 1 Reply Last reply
              0
              • raven-worxR raven-worx

                @JonB said in Quit in Windows:

                Windows apps don't tend to have a Quit menu item. And personally I shudder when I see a Windows program with one!

                actually its the exact opposite IMO. Almost all application with a File-menu have one.

                @mpergand said in Quit in Windows:

                bad, bad !

                whats bad about it?!

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #7

                @raven-worx said in Quit in Windows:

                @JonB said in Quit in Windows:

                Windows apps don't tend to have a Quit menu item. And personally I shudder when I see a Windows program with one!

                actually its the exact opposite IMO. Almost all application with a File-menu have one.

                Pardon? Almost all Windows application have Exit on File menu, which is the standard (e.g. look at any Microsoft application), most I have seen which have a Quit are "non-Windows" applications.

                raven-worxR 1 Reply Last reply
                1
                • JonBJ JonB

                  @raven-worx said in Quit in Windows:

                  @JonB said in Quit in Windows:

                  Windows apps don't tend to have a Quit menu item. And personally I shudder when I see a Windows program with one!

                  actually its the exact opposite IMO. Almost all application with a File-menu have one.

                  Pardon? Almost all Windows application have Exit on File menu, which is the standard (e.g. look at any Microsoft application), most I have seen which have a Quit are "non-Windows" applications.

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by
                  #8

                  @JonB
                  so you just talking about the texts Exit and Quit?!
                  I thought it's about haven such an action at all...

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  JonBJ 1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Can you show a minimal example that reproduce the behaviour on macOS ?
                    By the way, which version of Qt are you using ?
                    Which version of macOS are you running ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • raven-worxR raven-worx

                      @JonB
                      so you just talking about the texts Exit and Quit?!
                      I thought it's about haven such an action at all...

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #10

                      @raven-worx said in Quit in Windows:

                      @JonB
                      so you just talking about the texts Exit and Quit?!
                      I thought it's about haven such an action at all...

                      Yes. Just as MacOS users will expect the MacOS Quit instead of Exit.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mgreenish
                        wrote on last edited by
                        #11

                        Re: Quit in Windows

                        Hello all,

                        Thank you for the quick feedback. I have implemented the dynamic creation of the application 'Exit' only for Windows, as proposed.

                        @JonB: Yes, Exit is the standard on Windows, thank you for pointing that out but from your post, as raven-worx, I didn't understand right away you were saying they use 'Exit' rather than 'Quit'. Thanks for clarifying further on.

                        @SGaist: Thank you for the more complete code snippet. I figured out that i had made a mistake in my form declaration of the action and that is probably when when I tried to add it to the File menu, Command-Q stopped working under Mac.

                        Thanks!!

                        1 Reply Last reply
                        1

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved