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, 4.8.5: QAction in main menu not obeying AboutRole menu role [Solved]
Qt 6.11 is out! See what's new in the release blog

Mac, 4.8.5: QAction in main menu not obeying AboutRole menu role [Solved]

Scheduled Pinned Locked Moved General and Desktop
11 Posts 2 Posters 3.3k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    I'm not sure I am following you properly so:

    It's working properly with Qt 4.8.4 but not 4.8.5, is that right ?

    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
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #3

      I have rewritten my post. It was late.

      As I recall, yes, but it's been a while. At least it worked in 5.x.

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

        Just tried with a little dummy app but it seems to be working. Do you have a minimal example that I could try ?

        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
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #5

          Just tried the same; works in a new project. I'll try to boil my project down to a minimal main window example.

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #6

            Found the problem. As per http://qt-project.org/doc/qt-4.8/qmenubar.html#qmenubar-on-mac-os-x , menu item texts containing the string "about*" automatically gets assigned the menu role, and moved to the "appropriate" place. The problem is, my application is a browser-like application with dynamically loaded browser bookmark and history menus. Guess what? Some of the items were from "about.com", which explains that when I triggered the "About..." menu item, the page from about.com gets loaded. Sort of explains everything.

            But - both QAction::setMenuRole(QAction::NoRole) and QAction::setMenuRole(QAction:: TextHeuristicRole) on the dynamic items are being ignored. They are still triggered by the "About..." menu item.
            I'm pretty sure this was ok in Qt4.8.4.

            Am I overseeing something here? I just need ONE Qt version that works properly on the Mac, then I would be happy. If I'm not overseeing something, then I'm out options, and will start porting my application to pure c or assembly language. That would probably be less frustrating.

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

              Can you post a minimal QAction setup that shows this behavior ?

              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
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #8

                Nope, thankfully :-D

                Created a minimal example, turns his the menu role HAS to be QAction::NoRole, QAction::TextHeuristicRole won't cut it. Once I changed this consistently in my application, it worked.

                Thanks ;-)

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

                  Great ! :)

                  Thanks for sharing the solution.

                  You could add a doc note on QAction explaining this, that might help others :)

                  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
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #10

                    Done for 4.8 :-)

                    http://qt-project.org/doc/qt-4.8/qaction.html

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

                      Nice, thank you !

                      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

                      • Login

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