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. MainWindow doesnt show MenuBar

MainWindow doesnt show MenuBar

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 4 Posters 5.0k Views
  • 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.
  • V Vadik

    @medyakovvit Already tried this, and many of other combination "removing-adding". No one helps

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by
    #6

    @Vadik
    So you've tried this?

    QMenuBar *mb = menuBar();
    mb->addMenu(file);
    this->setMenuBar(mb);
    

    Also see https://stackoverflow.com/questions/41367027/qt-add-menubar-menus-and-sub-menus-to-qmainwindow

    V 1 Reply Last reply
    0
    • JonBJ JonB

      @Vadik
      So you've tried this?

      QMenuBar *mb = menuBar();
      mb->addMenu(file);
      this->setMenuBar(mb);
      

      Also see https://stackoverflow.com/questions/41367027/qt-add-menubar-menus-and-sub-menus-to-qmainwindow

      V Offline
      V Offline
      Vadik
      wrote on last edited by
      #7

      @JNBarchan said in MainWindow doesnt show MenuBar:

      QMenuBar *mb = menuBar();
      mb->addMenu(file);
      this->setMenuBar(mb);

      yes, have tried, and the same code is working on other machines.

      JonBJ 1 Reply Last reply
      0
      • V Vadik

        @JNBarchan said in MainWindow doesnt show MenuBar:

        QMenuBar *mb = menuBar();
        mb->addMenu(file);
        this->setMenuBar(mb);

        yes, have tried, and the same code is working on other machines.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #8

        @Vadik
        Oh, this is the first time you're saying the code works on some machines and not others?

        V 1 Reply Last reply
        0
        • JonBJ JonB

          @Vadik
          Oh, this is the first time you're saying the code works on some machines and not others?

          V Offline
          V Offline
          Vadik
          wrote on last edited by
          #9

          @JNBarchan yeah, I just forgot, allready corrected. Thanks for reminder.

          JonBJ 1 Reply Last reply
          0
          • V Vadik

            @JNBarchan yeah, I just forgot, allready corrected. Thanks for reminder.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #10

            @Vadik
            So I would look at exactly what version of Qt libraries is being used on your machine versus other machines? Maybe they have a later version than your 5.5, and it will work then?

            V 1 Reply Last reply
            0
            • JonBJ JonB

              @Vadik
              So I would look at exactly what version of Qt libraries is being used on your machine versus other machines? Maybe they have a later version than your 5.5, and it will work then?

              V Offline
              V Offline
              Vadik
              wrote on last edited by
              #11

              @JNBarchan Allready reinstalled Qt up to 5.9.2 version. And still didn't help

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

                Hi,

                Aren't you on Ubuntu ? If so, isn't your menu bar shown at the top of the screen macOS like ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                JonBJ V 2 Replies Last reply
                2
                • SGaistS SGaist

                  Hi,

                  Aren't you on Ubuntu ? If so, isn't your menu bar shown at the top of the screen macOS like ?

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #13

                  @SGaist
                  LOL if that's what OP means. I have my desktop preference set to show menus on windows, but the default is on system menu.

                  1 Reply Last reply
                  1
                  • SGaistS SGaist

                    Hi,

                    Aren't you on Ubuntu ? If so, isn't your menu bar shown at the top of the screen macOS like ?

                    V Offline
                    V Offline
                    Vadik
                    wrote on last edited by
                    #14
                    This post is deleted!
                    V 1 Reply Last reply
                    0
                    • V Vadik

                      This post is deleted!

                      V Offline
                      V Offline
                      Vadik
                      wrote on last edited by Vadik
                      #15

                      @Vadik YEEEEAH, solved, after some investigations and reinstalling of all components it turned out. Need to change in 'System Settings -> Appearance -> Behavior' parameter for 'Show the menus for a window' from the "In the menu bar" to "In the window's title bar". Thanks to everyone who tried to help.

                      1 Reply Last reply
                      1
                      • JonBJ JonB

                        @medyakovvit
                        Won't he need setMenuBar(sb) for his main window too?

                        M Offline
                        M Offline
                        medyakovvit
                        wrote on last edited by
                        #16

                        @JNBarchan Question is solved, but as you asked.
                        I don't think it's needed as he gets pointer to menu bar with:

                        QMenuBar *mb = menuBar();
                        

                        and this function returns the menu bar that already set.

                        JonBJ 1 Reply Last reply
                        1
                        • M medyakovvit

                          @JNBarchan Question is solved, but as you asked.
                          I don't think it's needed as he gets pointer to menu bar with:

                          QMenuBar *mb = menuBar();
                          

                          and this function returns the menu bar that already set.

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by JonB
                          #17

                          @medyakovvit
                          Yeah, I kinda mis-read (C++ not being my language) it as having been:

                          QMenuBar *mb = new QMenuBar();
                          

                          thinking he was creating his own new one which would need setting. Using the existing menubar and changing its content is of course preferable.

                          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