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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    Which version of Qt are you using ? On which version of OS X ?

    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
    • N Offline
      N Offline
      Nevering
      wrote on last edited by
      #3

      Qt 5.7 and Mac OSX 10.11.6

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

        This is a construction menu if that makes a differnce

                    MenuInfo menuInfo = itMenu.next();
                    QString menuTitle = menuInfo.getTitle();
                    if (!menuTitle.isEmpty())
                    {
                        QAction * menuAction = new QAction(this);
                        menuAction->setData(menuInfo.getFormId());
                        menuAction->setText(menuTitle);
                        menuAction->setToolTip(menuInfo.getDescription());
                        menuAction->setStatusTip(menuInfo.getDescription());
                        mainMenu->addAction(menuAction);
                        connect(menuAction, &QAction::triggered, this, &MainWindow::openForm);
                    }
        
        1 Reply Last reply
        0
        • N Offline
          N Offline
          Nevering
          wrote on last edited by
          #5

          I am surprised this hasn't got more responses. This is an obvious bug in Qt, after further playing with it, and compromises Qt's Cross platform claim. Is there a way to debug Qt source on this ?

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

            Sorry, I missed your answer.

            I can't reproduce your problem because in the code you provided there are unknown elements: MenuInfo, itMenu and mainMenu.

            Sure you can debug Qt, the source is freely available either be cloning it with git or downloading the sources from the version you installed on your computer.

            Before stating that there is an obvious bug, please provide a minimal compilable example that reproduce the behavior.

            Also, please note that this forum is community driven so there might not be many people here having the same hardware/OS version as you at hand.

            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
            • N Offline
              N Offline
              Nevering
              wrote on last edited by
              #7

              i understand that this is a community forum, but a bug that compromises cross platform to Mac would seem to be of huge concern . I did some researching and it seems that this problem was reported in 4.8. I can't find it right now, when I do I'll give a link. Apparently, it's been around for awhile, yet still alive and well.

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

                I haven't noticed this problem (I currently use Qt 5.6.0, OS X 10.10.5, XCode 7.2.1). It could be something new with Qt 5.7.x but I hadn't seen anything like this in previous versions (your hint that it might have existed since 4.8.x). I don't use a lot of menu's or complex menus but I do have menu's in some applications and they do work (I even double checked to make sure). I have never had an issue running these on any version of OS X that I have had (snow leopard and up) or at least anything that was noticable.

                As @SGaist mentioned can you provide a minimal example showing this problem.

                In your sample code is it possible that 'menuTitle' is an empty string in some cases and maybe this is why the menu is not constructed?.

                MenuInfo menuInfo = itMenu.next();
                QString menuTitle = menuInfo.getTitle();
                if (!menuTitle.isEmpty())
                {
                   // create menu skipped if menuTitle is empty
                }
                
                N 1 Reply Last reply
                1
                • K Offline
                  K Offline
                  kenchan
                  wrote on last edited by
                  #9

                  I too have an application that runs on Mac and Windows and have never seen the behaviour you describe. As other folks have said it may be a 5.7 regression but it must have been fixed since 4.8 or Rondog and I (and probably many others) would surly have noticed it.

                  As Rondog and SGaist suggest, you should show more code so we can reproduce the issue. It is better to provide a minimum app with a main window and the menus set up the way your app does it.

                  Do you get the same problem when you build the MainWindow example or the Menus example for instance?

                  1 Reply Last reply
                  1
                  • R Rondog

                    I haven't noticed this problem (I currently use Qt 5.6.0, OS X 10.10.5, XCode 7.2.1). It could be something new with Qt 5.7.x but I hadn't seen anything like this in previous versions (your hint that it might have existed since 4.8.x). I don't use a lot of menu's or complex menus but I do have menu's in some applications and they do work (I even double checked to make sure). I have never had an issue running these on any version of OS X that I have had (snow leopard and up) or at least anything that was noticable.

                    As @SGaist mentioned can you provide a minimal example showing this problem.

                    In your sample code is it possible that 'menuTitle' is an empty string in some cases and maybe this is why the menu is not constructed?.

                    MenuInfo menuInfo = itMenu.next();
                    QString menuTitle = menuInfo.getTitle();
                    if (!menuTitle.isEmpty())
                    {
                       // create menu skipped if menuTitle is empty
                    }
                    
                    N Offline
                    N Offline
                    Nevering
                    wrote on last edited by
                    #10

                    @Rondog

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

                    I haven't noticed this problem (I currently use Qt 5.6.0, OS X 10.10.5, XCode 7.2.1). It could be something new with Qt 5.7.x but I hadn't seen anything like this in previous versions (your hint that it might have existed since 4.8.x). I don't use a lot of menu's or complex menus but I do have menu's in some applications and they do work (I even double checked to make sure). I have never had an issue running these on any version of OS X that I have had (snow leopard and up) or at least anything that was noticable.

                    As @SGaist mentioned can you provide a minimal example showing this problem.

                    In your sample code is it possible that 'menuTitle' is an empty string in some cases and maybe this is why the menu is not constructed?.

                    MenuInfo menuInfo = itMenu.next();
                    QString menuTitle = menuInfo.getTitle();
                    if (!menuTitle.isEmpty())
                    {
                       // create menu skipped if menuTitle is empty
                    }
                    

                    The menu is constructed and displayed. It's just inactive until clicking on another program and then back to the this Qt app. It only has 2 menu items the default one on Mac and the one created in code.

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

                      Then, please, provide us the means to reproduce that situation.

                      We are already several people not getting that problem. Therefore without your code we cannot help to either find the bug that you might have uncovered in Qt or find the one that you have in your application.

                      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
                      4
                      • N Offline
                        N Offline
                        Nevering
                        wrote on last edited by
                        #12

                        I'm trying to put something together. It seems like if I have a .ui file for the mainwindow and use the ui-> things seem to work, if I don't then that's when the problems seem to appear. I'm trying to make a small example.

                        1 Reply Last reply
                        0
                        • 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

                                          • Login

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