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 make the same stylesheet as the menubar of qt-creator?
QtWS25 Last Chance

How to make the same stylesheet as the menubar of qt-creator?

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

    0_1540103136786_6.gif

    When the mouse pointer hovers on the menus Tools and Window, we can get that: the menu magin is 0px, and padding is greater than 0px().

    So I wrote the below qss codes:

    QMenuBar::item
    {
        margin: 0px 10px;
        padding: 5px;
    }
    

    But it didn't work.

    0_1540103561271_7.gif

    If i want to make the same stylesheet as the menubar of qt-creator, how should I do?

    U 1 Reply Last reply
    0
    • LimerL Limer

      0_1540103136786_6.gif

      When the mouse pointer hovers on the menus Tools and Window, we can get that: the menu magin is 0px, and padding is greater than 0px().

      So I wrote the below qss codes:

      QMenuBar::item
      {
          margin: 0px 10px;
          padding: 5px;
      }
      

      But it didn't work.

      0_1540103561271_7.gif

      If i want to make the same stylesheet as the menubar of qt-creator, how should I do?

      U Offline
      U Offline
      user4592357
      wrote on last edited by
      #2

      @Limer
      you don't need to set the margin and padding of the items, they should be as you want by default.

      LimerL 1 Reply Last reply
      0
      • U user4592357

        @Limer
        you don't need to set the margin and padding of the items, they should be as you want by default.

        LimerL Offline
        LimerL Offline
        Limer
        wrote on last edited by
        #3

        @user4592357

        I tried it, but the menus were moved to the top automatically, they didn't centered In the vertical direction.

        0_1540114038328_8.gif

        U 1 Reply Last reply
        1
        • LimerL Limer

          @user4592357

          I tried it, but the menus were moved to the top automatically, they didn't centered In the vertical direction.

          0_1540114038328_8.gif

          U Offline
          U Offline
          user4592357
          wrote on last edited by user4592357
          #4

          @Limer
          the menu bar is okay, it hasn't moved anywhere; it has the height of the widget that you added after it...
          you can try setting the height of that widget to something smaller.

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

            Hi,

            IIRC, Qt Creator is using a custom style. You should take a look at it sources.

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

            LimerL 1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              IIRC, Qt Creator is using a custom style. You should take a look at it sources.

              LimerL Offline
              LimerL Offline
              Limer
              wrote on last edited by
              #6

              @SGaist Yes, I searched QMenuBar, but don't find the css/qss codes about the QMenuBar.

              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