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. QToolBar not available from Design UI
Forum Updated to NodeBB v4.3 + New Features

QToolBar not available from Design UI

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.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.
  • L Offline
    L Offline
    lukutis222
    wrote on last edited by
    #1

    Hello. I was checking out Qt terminal example:
    efe005df-22ee-47df-b93f-ff1a04c1c811-image.png

    And noticed QToolBar widget that looked good and I would like to add this widget in my application, however, it is not available to select from the UI design window:

    97eb104a-4964-4643-a60c-0e183c413e80-image.png

    Is there any way to import this widget?

    JonBJ 1 Reply Last reply
    0
    • L lukutis222

      Hello. I was checking out Qt terminal example:
      efe005df-22ee-47df-b93f-ff1a04c1c811-image.png

      And noticed QToolBar widget that looked good and I would like to add this widget in my application, however, it is not available to select from the UI design window:

      97eb104a-4964-4643-a60c-0e183c413e80-image.png

      Is there any way to import this widget?

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

      @lukutis222
      In Designer QToolBar is only available on a QmainWindow. See https://forum.qt.io/topic/82936/how-to-create-toolbar-in-design-created-by-qt-designer-design-creation-is-started-from-qwidget .

      1 Reply Last reply
      1
      • L Offline
        L Offline
        lukutis222
        wrote on last edited by lukutis222
        #3

        Ah what a bummer. When I started making my application, I was not aware of differences between two. Main Window is much more suitable for making applications I guess.

        JonBJ 1 Reply Last reply
        0
        • L lukutis222

          Ah what a bummer. When I started making my application, I was not aware of differences between two. Main Window is much more suitable for making applications I guess.

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

          @lukutis222
          Well, main window is more suitable if (and only if) you want the facilities of a main window! Did you see the diagram at https://doc.qt.io/qt-6/qmainwindow.html#qt-main-window-framework ?

          L 1 Reply Last reply
          0
          • JonBJ JonB

            @lukutis222
            Well, main window is more suitable if (and only if) you want the facilities of a main window! Did you see the diagram at https://doc.qt.io/qt-6/qmainwindow.html#qt-main-window-framework ?

            L Offline
            L Offline
            lukutis222
            wrote on last edited by
            #5

            @JonB
            Now I have. I now understand that main window is definately more suitable for my application. Its not too late to move all my code form widget class to mainwindow so its not a problem.. Thank you :)

            JonBJ M 2 Replies Last reply
            0
            • L lukutis222

              @JonB
              Now I have. I now understand that main window is definately more suitable for my application. Its not too late to move all my code form widget class to mainwindow so its not a problem.. Thank you :)

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

              @lukutis222
              A QMainWindow is simply a specialized QWidget with the added "furniture" shown in the docs diagram. If you want any of menu, toolbar, docks or status bar it gives them (optionally) to you. It would be usual to have only one QMainWindow in an application, because it is for the main window! You may have further widgets, dialogs etc., or maybe your application is so simple it just has a main window and that is all.

              Don't forget that a QMainWindow has one "central widget", apart from its "furniture". What you were designing as a QWidget may be suitable for that widget.

              1 Reply Last reply
              0
              • L lukutis222

                @JonB
                Now I have. I now understand that main window is definately more suitable for my application. Its not too late to move all my code form widget class to mainwindow so its not a problem.. Thank you :)

                M Offline
                M Offline
                mpergand
                wrote on last edited by mpergand
                #7

                @lukutis222
                Don't use QWidget as top level widget.
                Always use QMainWindow for main application window and document windows.
                Otherwise use QDialogs.

                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