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. Mac Menus are not active ????
Forum Updated to NodeBB v4.3 + New Features

Mac Menus are not active ????

Scheduled Pinned Locked Moved Unsolved General and Desktop
40 Posts 7 Posters 9.0k Views 3 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.
  • N Offline
    N Offline
    Nevering
    wrote on last edited by
    #13

    I have tried to reproduce this problem with smaller subsets of code and cannot. I not really sure how to debug this problem.

    I've rebuilt the project from scratch adding items and testings as I went along. Everything worked fine up the the point of adding a resource file .

    Currently I have only the default Mac menu item, everything else is on the toolbar and working. All the application works except for the menu being dead until clicking on another program and then back.

    mrjjM 1 Reply Last reply
    1
    • N Nevering

      I have tried to reproduce this problem with smaller subsets of code and cannot. I not really sure how to debug this problem.

      I've rebuilt the project from scratch adding items and testings as I went along. Everything worked fine up the the point of adding a resource file .

      Currently I have only the default Mac menu item, everything else is on the toolbar and working. All the application works except for the menu being dead until clicking on another program and then back.

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #14

      @Nevering
      If you have a sample that can be built and tested,
      please upload to git or any other site where
      its easy for people to get it as one zip/together easy to run project.

      That way its very likely that others will try your test program and we can find out if
      its just on your system or its actually a Qt bug :)

      1 Reply Last reply
      2
      • N Offline
        N Offline
        Nevering
        wrote on last edited by
        #15

        I was able to reproduce this in a small test project. I don't see a way of uploading a zip file

        S 1 Reply Last reply
        0
        • N Nevering

          I was able to reproduce this in a small test project. I don't see a way of uploading a zip file

          S Offline
          S Offline
          sandy.martel23
          wrote on last edited by
          #16

          @Nevering

          Once your menubar is created, add those 2 lines:

          // Qt5.6: this seems to force the previous menubar to show up and activate
          auto m = new QMenuBar; 
          m->deleteLater();
          

          This create another parentless top-level menubar and delete it later. I've been debugging through Qt's macOS menu handling code and it seems to have changed a lot between Qt5.5 and Qt5.6. This code triggers the native menu bar synchronisation that used to happen automatically. Looks like they screw this up for 5.6.

          1 Reply Last reply
          2
          • N Offline
            N Offline
            Nevering
            wrote on last edited by
            #17

            Thanks for the answer, but that didn't help.. Still got a hang

            1 Reply Last reply
            0
            • N Offline
              N Offline
              Nevering
              wrote on last edited by
              #18

              added it like this

              ui->setupUi(this);
              QPixmap pix(":/images/user.png");
              QIcon ico(pix);
              ui->toolButton->setIcon(ico);
              
              auto m = new QMenuBar;
              m->deleteLater();
              

              I'll try again after the ui->setup

              1 Reply Last reply
              1
              • N Offline
                N Offline
                Nevering
                wrote on last edited by
                #19

                Same thing

                S 1 Reply Last reply
                0
                • N Nevering

                  Same thing

                  S Offline
                  S Offline
                  sandy.martel23
                  wrote on last edited by
                  #20

                  @Nevering
                  A test project would be great.

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    Nevering
                    wrote on last edited by
                    #21

                    I think I've added the code here ??
                    https://github.com/Nevering/Splitters.git

                    S 1 Reply Last reply
                    0
                    • N Nevering

                      I think I've added the code here ??
                      https://github.com/Nevering/Splitters.git

                      S Offline
                      S Offline
                      sandy.martel23
                      wrote on last edited by
                      #22

                      @Nevering
                      "This repository is empty."

                      1 Reply Last reply
                      0
                      • N Offline
                        N Offline
                        Nevering
                        wrote on last edited by
                        #23

                        There now, please try again
                        learning github

                        S 1 Reply Last reply
                        0
                        • N Nevering

                          There now, please try again
                          learning github

                          S Offline
                          S Offline
                          sandy.martel23
                          wrote on last edited by
                          #24

                          @Nevering
                          Well, it's pretty simple in your case, don't do:

                          CONFIG -= app_bundle
                          
                          1 Reply Last reply
                          1
                          • N Offline
                            N Offline
                            Nevering
                            wrote on last edited by
                            #25

                            why ?

                            If I don't the files in the subdirectories are not found

                            S 1 Reply Last reply
                            0
                            • N Offline
                              N Offline
                              Nevering
                              wrote on last edited by
                              #26

                              Well not found in my actual application. that has sever folders were files are being used for building aspects of the application.

                              1 Reply Last reply
                              0
                              • N Nevering

                                why ?

                                If I don't the files in the subdirectories are not found

                                S Offline
                                S Offline
                                sandy.martel23
                                wrote on last edited by
                                #27

                                @Nevering said in Mac Menus are not active ????:

                                why ?

                                Gui applications on Mac are bundles.

                                If I don't the files in the subdirectories are not found

                                Look at how to embed resources, either the Qt way, with the 'Qt Resource Compiler' or the Mac's way with bundle resources.

                                If you really want to keep those as external files you'll need to adjust the relative path on Mac.

                                1 Reply Last reply
                                2
                                • N Offline
                                  N Offline
                                  Nevering
                                  wrote on last edited by
                                  #28

                                  is this a good reference, or is there a better one, this is from 4.8.

                                  http://doc.qt.io/qt-4.8/deployment-mac.html

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

                                    I ran a test and saw exactly what you described in this thread (Qt 5.6.0, OSX 10.10.5, XCode 7.2.1). I tried changing a few things here and there in the source to see if I could get it to work without success. Changes in the PRO file seemed to affect it.

                                    In the project file I remove this line:

                                    CONFIG -= app_bundle
                                    

                                    and replaced it with this:

                                    CONFIG +=release \
                                    		warn_on \
                                    		qt \
                                    		thread 
                                    

                                    It worked fine after this change for some reason.

                                    I didn't look into what the differences are in these options of the project file. These are common options I use for everything. Maybe try this and see if this works for you as well.

                                    I also tried converting the UI file into a set of cpp files (generic main.cpp, mainwindow.cpp, and mainwindow.h). It worked regardless of the above change in the PRO file.

                                    It looks like there is something odd going on but I am not sure what the source is. The project file supplied with this sample should be cleaned up regardless (maybe this is the underlying reason?). The project file from the CPP generated version is a little more complete so this could be a reason I didn't see this problem with the derived version and only with the UI version (?).

                                    N 1 Reply Last reply
                                    1
                                    • N Offline
                                      N Offline
                                      Nevering
                                      wrote on last edited by
                                      #30

                                      Someone please help me understand the problem. Why did CONFIG -= app_bundle cause the problem and removing fix it? The article linked above says that CONFIG -= app_bundle should be used for Macs .

                                      1 Reply Last reply
                                      0
                                      • R Rondog

                                        I ran a test and saw exactly what you described in this thread (Qt 5.6.0, OSX 10.10.5, XCode 7.2.1). I tried changing a few things here and there in the source to see if I could get it to work without success. Changes in the PRO file seemed to affect it.

                                        In the project file I remove this line:

                                        CONFIG -= app_bundle
                                        

                                        and replaced it with this:

                                        CONFIG +=release \
                                        		warn_on \
                                        		qt \
                                        		thread 
                                        

                                        It worked fine after this change for some reason.

                                        I didn't look into what the differences are in these options of the project file. These are common options I use for everything. Maybe try this and see if this works for you as well.

                                        I also tried converting the UI file into a set of cpp files (generic main.cpp, mainwindow.cpp, and mainwindow.h). It worked regardless of the above change in the PRO file.

                                        It looks like there is something odd going on but I am not sure what the source is. The project file supplied with this sample should be cleaned up regardless (maybe this is the underlying reason?). The project file from the CPP generated version is a little more complete so this could be a reason I didn't see this problem with the derived version and only with the UI version (?).

                                        N Offline
                                        N Offline
                                        Nevering
                                        wrote on last edited by
                                        #31

                                        @Rondog

                                        So the article that I linked says that CONFIG -= app_bundle is needed on Mac.. Is this not the case ? Is there any more recent documentation on how to build the bundle within Qt?

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

                                          You misunderstood the documentation. As stated just about the code snippet, the CONFIG -= app_bundle line applies only to command line tools.

                                          Otherwise, use a bundle. macOS looks for information in that bundle: the Info.plist file being the central point of interest. Qt generates one for you automatically with sensible defaults.

                                          Depending on what feature you'll be using, you will have to provide your own file.

                                          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
                                          1

                                          • Login

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