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. How can I add Menubar in Qt Designer?
Forum Updated to NodeBB v4.3 + New Features

How can I add Menubar in Qt Designer?

Scheduled Pinned Locked Moved Solved General and Desktop
13 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.
  • C Offline
    C Offline
    CuriousPan
    wrote on last edited by
    #1

    I know, it's kinda simple question, but I cannot find a way to add a menubar to a main window of my application? Is it even possible?

    eyllanescE 1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #2

      https://forum.qt.io/topic/130750/qmenubar-in-qwidget-windows/5

      1 Reply Last reply
      0
      • C CuriousPan

        I know, it's kinda simple question, but I cannot find a way to add a menubar to a main window of my application? Is it even possible?

        eyllanescE Offline
        eyllanescE Offline
        eyllanesc
        wrote on last edited by
        #3

        @CuriousPan QMainWindow comes with a QMenuBar by default:

        Screenshot_20211006_162030.png

        The section where "Type Here" is is the QMenuBar.

        You can remove the QMenuBar by right clicking on this section and selecting the option "Remove Menu Bar". If it is removed then right click on the window and select the option "Create Menu Bar".

        If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

        C 1 Reply Last reply
        2
        • eyllanescE eyllanesc

          @CuriousPan QMainWindow comes with a QMenuBar by default:

          Screenshot_20211006_162030.png

          The section where "Type Here" is is the QMenuBar.

          You can remove the QMenuBar by right clicking on this section and selecting the option "Remove Menu Bar". If it is removed then right click on the window and select the option "Create Menu Bar".

          C Offline
          C Offline
          CuriousPan
          wrote on last edited by
          #4

          @eyllanesc, excuse me, what am I doing wrong or am I clicking on some wrong place?

          7af493d9-7983-4cab-8524-5a0e954d4e8a-image.png

          eyllanescE 1 Reply Last reply
          0
          • C CuriousPan

            @eyllanesc, excuse me, what am I doing wrong or am I clicking on some wrong place?

            7af493d9-7983-4cab-8524-5a0e954d4e8a-image.png

            eyllanescE Offline
            eyllanescE Offline
            eyllanesc
            wrote on last edited by
            #5

            @CuriousPan I don't think it explains correctly, the QMainWindow already comes with a QMenuBar by default so you don't have to add it. If you removed it then you can add it by clicking on the window (it must be a section where there are no other widgets)

            If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

            C 1 Reply Last reply
            0
            • eyllanescE eyllanesc

              @CuriousPan I don't think it explains correctly, the QMainWindow already comes with a QMenuBar by default so you don't have to add it. If you removed it then you can add it by clicking on the window (it must be a section where there are no other widgets)

              C Offline
              C Offline
              CuriousPan
              wrote on last edited by
              #6

              @eyllanesc, I'm clicking on a black space of MainWidget (the one which is default and cannot be deleted), but unfortunately nothing appears.
              The reason I'm trying to add MenuBar is it was deleted when a development started and then I needed it.

              4fe20042-f71d-4850-856b-e487f3f57f2b-image.png

              jsulmJ 2 Replies Last reply
              0
              • C CuriousPan

                @eyllanesc, I'm clicking on a black space of MainWidget (the one which is default and cannot be deleted), but unfortunately nothing appears.
                The reason I'm trying to add MenuBar is it was deleted when a development started and then I needed it.

                4fe20042-f71d-4850-856b-e487f3f57f2b-image.png

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @CuriousPan said in How can I add Menubar in Qt Designer?:

                black space

                It's not black space where you have to click, its the grey space with the dots...

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • C CuriousPan

                  @eyllanesc, I'm clicking on a black space of MainWidget (the one which is default and cannot be deleted), but unfortunately nothing appears.
                  The reason I'm trying to add MenuBar is it was deleted when a development started and then I needed it.

                  4fe20042-f71d-4850-856b-e487f3f57f2b-image.png

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @CuriousPan I just tested: removed menu bar, right clicked on the empty space inside main window and the top (first) menu entry is the one to add menu bar...

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  C 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @CuriousPan I just tested: removed menu bar, right clicked on the empty space inside main window and the top (first) menu entry is the one to add menu bar...

                    C Offline
                    C Offline
                    CuriousPan
                    wrote on last edited by
                    #9

                    @jsulm, after some research, I spotted that my Main Window is actually a QWidget.

                    be8dbfad-032a-4a47-a4b4-b3fcdfff007e-image.png
                    Is it possible to add menu bar to QWidget?

                    eyllanescE jsulmJ 2 Replies Last reply
                    0
                    • C CuriousPan

                      @jsulm, after some research, I spotted that my Main Window is actually a QWidget.

                      be8dbfad-032a-4a47-a4b4-b3fcdfff007e-image.png
                      Is it possible to add menu bar to QWidget?

                      eyllanescE Offline
                      eyllanescE Offline
                      eyllanesc
                      wrote on last edited by eyllanesc
                      #10

                      @CuriousPan In theory it is possible (using layouts, etc) but don't complicate your life: better use QMainWindow.

                      Note: "MainWindow" is different to "MainWidget"

                      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

                      C 1 Reply Last reply
                      0
                      • eyllanescE eyllanesc

                        @CuriousPan In theory it is possible (using layouts, etc) but don't complicate your life: better use QMainWindow.

                        Note: "MainWindow" is different to "MainWidget"

                        C Offline
                        C Offline
                        CuriousPan
                        wrote on last edited by
                        #11

                        @eyllanesc, the reason I'd like to stay with a widget I'm having right now is that I have quite a lot already implemented on it.

                        eyllanescE 1 Reply Last reply
                        0
                        • C CuriousPan

                          @jsulm, after some research, I spotted that my Main Window is actually a QWidget.

                          be8dbfad-032a-4a47-a4b4-b3fcdfff007e-image.png
                          Is it possible to add menu bar to QWidget?

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @CuriousPan said in How can I add Menubar in Qt Designer?:

                          Is it possible to add menu bar to QWidget?

                          Yes, in code, not in designer.

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • C CuriousPan

                            @eyllanesc, the reason I'd like to stay with a widget I'm having right now is that I have quite a lot already implemented on it.

                            eyllanescE Offline
                            eyllanescE Offline
                            eyllanesc
                            wrote on last edited by
                            #13

                            @CuriousPan I don't think the process of converting the code from QWidget to QMainWindow is complicated, in general they are small changes

                            If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

                            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