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. Menu not showing up in menuBar

Menu not showing up in menuBar

Scheduled Pinned Locked Moved General and Desktop
20 Posts 18 Posters 32.5k 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.
  • L Loulou

    I had the same issue of the menu bar not showing (config: Qt 5.2 , ubuntu 13.10). This trick solved the issue:
    @menuBar()->setNativeMenuBar(false);@

    D Offline
    D Offline
    DavidMc
    wrote on last edited by
    #11

    Where would I add this code to get it to work? Not sure which file it has to go in. New to QT and any help would be appreciated :)

    ? 1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #12

      which platform you are trying ? If Ubuntu and Mac, platform do some intelligence. Just try to add few more actions like QAction("David") , QAction("Dheeru") like this. It will start showing up. Since you are default "Quit" and "Quit" is by default available. So it may not be showing up.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      4
      • D DavidMc

        Where would I add this code to get it to work? Not sure which file it has to go in. New to QT and any help would be appreciated :)

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #13

        @DavidMc Hi, add the following to your main.cpp:

        QCoreApplication::​setAttribute(Qt::AA_DontUseNativeMenuBar)
        

        Same effect, just for all your menu bars.
        Cheers!

        A 1 Reply Last reply
        1
        • W willy27

          [quote author="Loulou" date="1387722347"]I had the same issue of the menu bar not showing (config: Qt 5.2 , ubuntu 13.10). This trick solved the issue:
          @menuBar()->setNativeMenuBar(false);@[/quote]

          Thank you, It also worked for me on mac os !

          ElvisE Offline
          ElvisE Offline
          Elvis
          wrote on last edited by
          #14

          @willy27 It also affect my code.

          1 Reply Last reply
          0
          • W willy27

            [quote author="Loulou" date="1387722347"]I had the same issue of the menu bar not showing (config: Qt 5.2 , ubuntu 13.10). This trick solved the issue:
            @menuBar()->setNativeMenuBar(false);@[/quote]

            Thank you, It also worked for me on mac os !

            T Offline
            T Offline
            tallia1
            wrote on last edited by
            #15

            @willy27 Your temporary fix worked quite well. It's not pretty, but it does the job!!

            1 Reply Last reply
            0
            • ? A Former User

              @DavidMc Hi, add the following to your main.cpp:

              QCoreApplication::​setAttribute(Qt::AA_DontUseNativeMenuBar)
              

              Same effect, just for all your menu bars.
              Cheers!

              A Offline
              A Offline
              abagu
              wrote on last edited by
              #16

              I just ran into the same problem trying to follow the Qt5 tutorial from https://doc.qt.io/qt-5/qtwidgets-tutorials-notepad-example.html on MacOS Catalina (no menu bar mystery after building), which has no warnings about differences between platforms. This saved me some time before I delve into macextras

              1 Reply Last reply
              0
              • A Offline
                A Offline
                astroonaut
                wrote on last edited by astroonaut
                #17

                Hi guys, very new into Qt, just got this workin on high sierra/PyCharm/PyQt 5.15.3. My menubar is called "menubar" => self.menubar.setNativeMenuBar(False)
                ...if you try to solve it from python side. Thanks a bunch!

                S 1 Reply Last reply
                0
                • A astroonaut

                  Hi guys, very new into Qt, just got this workin on high sierra/PyCharm/PyQt 5.15.3. My menubar is called "menubar" => self.menubar.setNativeMenuBar(False)
                  ...if you try to solve it from python side. Thanks a bunch!

                  S Offline
                  S Offline
                  steelliberty
                  wrote on last edited by
                  #18

                  @astroonaut Excellent .. works- Thanks

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    process detach
                    wrote on last edited by
                    #19

                    Late bump, but one possibility if this is coming from PyQT - if the menu is not attributed to a class, it will be deleted by the garbage collection. changing menu = ... menuBar().addMenu('XX') to self.menu ..... worked for me.

                    1 Reply Last reply
                    0
                    • enjoysmathE Offline
                      enjoysmathE Offline
                      enjoysmath
                      wrote on last edited by
                      #20

                      Well, there's no more window bar nor app icons on Windows 10

                      https://github.com/enjoysmath
                      https://math.stackexchange.com/users/26327/exercisingmathematician

                      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