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 to create a toolbar like in Qt Creator?

How to create a toolbar like in Qt Creator?

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 7 Posters 433 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.
  • J Offline
    J Offline
    Jo Jo
    wrote on 28 Mar 2025, 13:23 last edited by
    #1

    In Windows, when we use Dark mode, Qt Creator creates a toolbar that looks like this:
    alt text

    But if we create a QToolBar ourselves using C++/Qt (dark mode, fusion style), the toolbar looks slightly different:
    alt text

    1. How to remove the button that is on the left (I don't know what it's called, but it can be used to drag the toolbar along the edges of the window)
    2. How to make the toolbar look the same as in Qt Creator? Maybe I should use another widget instead of QToolBar?
    J 1 Reply Last reply 28 Mar 2025, 13:29
    0
    • J Jo Jo
      28 Mar 2025, 13:23

      In Windows, when we use Dark mode, Qt Creator creates a toolbar that looks like this:
      alt text

      But if we create a QToolBar ourselves using C++/Qt (dark mode, fusion style), the toolbar looks slightly different:
      alt text

      1. How to remove the button that is on the left (I don't know what it's called, but it can be used to drag the toolbar along the edges of the window)
      2. How to make the toolbar look the same as in Qt Creator? Maybe I should use another widget instead of QToolBar?
      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 28 Mar 2025, 13:29 last edited by
      #2

      @Jo-Jo If you don't want the tool bar to be movable then use https://doc.qt.io/qt-6/qtoolbar.html#movable-prop
      You can also try https://doc.qt.io/qt-6/qtoolbar.html#floatable-prop

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

      J 1 Reply Last reply 28 Mar 2025, 13:40
      2
      • J jsulm
        28 Mar 2025, 13:29

        @Jo-Jo If you don't want the tool bar to be movable then use https://doc.qt.io/qt-6/qtoolbar.html#movable-prop
        You can also try https://doc.qt.io/qt-6/qtoolbar.html#floatable-prop

        J Offline
        J Offline
        Jo Jo
        wrote on 28 Mar 2025, 13:40 last edited by
        #3

        @jsulm

         toolBar->setProperty("movable", false);
        

        Works fine, thank you! But how to make the toolbar look like in Qt Creator? Such a toolbar does not exist in Qt and I need to apply styles for customization?

        J P S 3 Replies Last reply 28 Mar 2025, 13:46
        0
        • J Jo Jo
          28 Mar 2025, 13:40

          @jsulm

           toolBar->setProperty("movable", false);
          

          Works fine, thank you! But how to make the toolbar look like in Qt Creator? Such a toolbar does not exist in Qt and I need to apply styles for customization?

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 28 Mar 2025, 13:46 last edited by
          #4

          @Jo-Jo said in How to create a toolbar like in Qt Creator?:

          But how to make the toolbar look like in Qt Creator?

          By adding widgets you need to the tool bar I guess? Or do you mean the color? In that case it's style sheet.
          QtCreator is open source you can check how it is implemented and styled.

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

          J 1 Reply Last reply 28 Mar 2025, 13:52
          2
          • J jsulm
            28 Mar 2025, 13:46

            @Jo-Jo said in How to create a toolbar like in Qt Creator?:

            But how to make the toolbar look like in Qt Creator?

            By adding widgets you need to the tool bar I guess? Or do you mean the color? In that case it's style sheet.
            QtCreator is open source you can check how it is implemented and styled.

            J Offline
            J Offline
            Jo Jo
            wrote on 28 Mar 2025, 13:52 last edited by
            #5

            @jsulm Thank you!

            S 1 Reply Last reply 28 Mar 2025, 19:39
            0
            • J Jo Jo
              28 Mar 2025, 13:40

              @jsulm

               toolBar->setProperty("movable", false);
              

              Works fine, thank you! But how to make the toolbar look like in Qt Creator? Such a toolbar does not exist in Qt and I need to apply styles for customization?

              P Offline
              P Offline
              Pl45m4
              wrote on 28 Mar 2025, 18:42 last edited by
              #6

              @Jo-Jo said in How to create a toolbar like in Qt Creator?:

              toolBar->setProperty("movable", false);

              toolBar->setMovable(false);
              

              is shorter ;-)


              If debugging is the process of removing software bugs, then programming must be the process of putting them in.

              ~E. W. Dijkstra

              1 Reply Last reply
              2
              • J Jo Jo
                28 Mar 2025, 13:52

                @jsulm Thank you!

                S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 28 Mar 2025, 19:39 last edited by
                #7

                @Jo-Jo hi,

                Just in case, Qt Creator's source code is open source so you can also learn from it directly :-)

                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
                1
                • S Online
                  S Online
                  SamiV123
                  wrote on 29 Mar 2025, 07:51 last edited by SamiV123
                  #8
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • J Jo Jo
                    28 Mar 2025, 13:40

                    @jsulm

                     toolBar->setProperty("movable", false);
                    

                    Works fine, thank you! But how to make the toolbar look like in Qt Creator? Such a toolbar does not exist in Qt and I need to apply styles for customization?

                    S Offline
                    S Offline
                    SimonSchroeder
                    wrote on 31 Mar 2025, 06:30 last edited by
                    #9

                    @Jo-Jo said in How to create a toolbar like in Qt Creator?:

                    Works fine, thank you! But how to make the toolbar look like in Qt Creator?

                    The tool bar you are showing has a QComboBox (this is just adding any widget to the toolbar which is possible). Next to that are most likely QToolButtons. These can also be changed to have a toggle state or a drop down menu. Tool buttons are especially designed to be used inside tool bars. They have a picture/symbol but usually no text.

                    J 1 Reply Last reply 31 Mar 2025, 10:07
                    2
                    • S SimonSchroeder
                      31 Mar 2025, 06:30

                      @Jo-Jo said in How to create a toolbar like in Qt Creator?:

                      Works fine, thank you! But how to make the toolbar look like in Qt Creator?

                      The tool bar you are showing has a QComboBox (this is just adding any widget to the toolbar which is possible). Next to that are most likely QToolButtons. These can also be changed to have a toggle state or a drop down menu. Tool buttons are especially designed to be used inside tool bars. They have a picture/symbol but usually no text.

                      J Offline
                      J Offline
                      Jo Jo
                      wrote on 31 Mar 2025, 10:07 last edited by
                      #10

                      @SimonSchroeder said in How to create a toolbar like in Qt Creator?:

                      The tool bar you are showing has a QComboBox (this is just adding any widget to the toolbar which is possible). Next to that are most likely QToolButtons. These can also be changed to have a toggle state or a drop down menu. Tool buttons are especially designed to be used inside tool bars. They have a picture/symbol but usually no text.

                      Thank you!

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kris25schr
                        wrote on 11 Apr 2025, 10:07 last edited by
                        #11
                        This post is deleted!
                        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