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. [SOLVED]QGuiApplication and 'About Menu' on OSX
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]QGuiApplication and 'About Menu' on OSX

Scheduled Pinned Locked Moved General and Desktop
12 Posts 3 Posters 2.7k Views 1 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
    MaxL
    wrote on last edited by MaxL
    #1

    Hi everyone,

    I red somewhere in Qt's doc that Qt should handle by itself the 'About myApp' on OS X.
    However I do not see it when I run my application.

    I am using Qt 5.4.0, my app is a QGuiApplication in which I have a QQuickView with the following flags:
    @Qt::Window |
    Qt::WindowTitleHint |
    Qt::WindowSystemMenuHint |
    Qt::WindowMinMaxButtonsHint |
    Qt::WindowCloseButtonHint |
    Qt::WindowFullscreenButtonHint@

    Am I missing something that makes the App to not have this menu ?

    I also have a plist file with copyright, version and bundle version.

    Thanks :)

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rondog
      wrote on last edited by
      #2

      You can have generic information about Qt displayed in the menu but you still need to put it there yourself.

      To add this in your menu add QAction with the triggered() signal connected to the slot QApplication::aboutQt()

      Note: On second read of the post this is probably off topic. I did check a program I wrote To see if I had an 'About Application'. I didn't do anything to make this happen but somehow it did and connected to the right 'page' of my program.

      Note 2: After some additional checking I noticed it took the last QAction item added to the last QMenu item and turned this into my Qbout 'My App' option on OS X. Interesting...

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MaxL
        wrote on last edited by
        #3

        Thanks for your answer, but how do I add it to the QGuiApplication ? Because I do not use QWidgets :S

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rondog
          wrote on last edited by
          #4

          I didn't do anything to add this (didn't even realize it did it until a moment ago).

          In my case it was the last QAction item added to the last QMenu.

          @
          view_menu = new QMenu("View");
          view_menu->addAction(d_components_action);
          view_menu->addAction(d_variables_action);
          view_menu->addAction(d_groups_action);
          view_menu->addAction(d_report_action);
          view_menu->addAction(d_log_action);
          view_menu->addAction(d_about_action);
          menu_bar->addMenu(view_menu);
          @

          The 'd_about_action' doesn't appear in the menu under 'view' but under the application - about section.

          I didn't do anything more than this and didn't give it any hints that this action should be treated special.

          Even if you don't use QWidgets you can still create QAction and QMenu I assume?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MaxL
            wrote on last edited by
            #5

            Yup I have a QAction created, however I cannot create a QMenuBar or QMenu since they are QWidgets and requires a QApplication instead of a QGuiApplication...

            1 Reply Last reply
            0
            • M Offline
              M Offline
              MaxL
              wrote on last edited by
              #6

              So I cannot use the Application::aboutQt since it opens a QWidget .. I probably will have to do my own about section but I need first to get this About field in the MenuBar..

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Rondog
                wrote on last edited by
                #7

                I can't say anything about this other then to verify what you read in the Qt doc files is correct.

                Maybe adding the menu and options using the native API?

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  MaxL
                  wrote on last edited by
                  #8

                  Moreover aboutQt() shows info for Qt but not a minimalist window with info of the application ( Logo name version and copyright according from the plist file )

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    MaxL
                    wrote on last edited by
                    #9

                    No pb, I will continue my investigation and if someone comes around with a solution for non QWidget app I would be glad to have a solution.

                    Native approach would work but I'd rather stay within Qt

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

                      Hi,

                      I havent't tested it but wouldn't the MenuBar from the QtQuick.Controls module allow to setup that ?

                      Hope it helps

                      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
                      • M Offline
                        M Offline
                        MaxL
                        wrote on last edited by
                        #11

                        I tried to use the MenuBar but it needs an ApplicationWindow as the root but in my case it is an Item that is the root of my QQuickView

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          MaxL
                          wrote on last edited by
                          #12

                          To close the subject ( left open for a while ... ) I finally found the solution by using a QApplication instead of using a QGuiApplication and by creating a new QMenuBar with a QMenu named "aboutMyApp" that is automatically placed in the right place under OS X.

                          1 Reply Last reply
                          0

                          • Login

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