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 change padding for icon on QMenuBar::item
Qt 6.11 is out! See what's new in the release blog

How can i change padding for icon on QMenuBar::item

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 3.9k 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
    Craetor
    wrote on last edited by
    #1
    QMenu::item {
        min-height: 20px;
        background-color: #444444;
        color : white;
        border: 1px solid;
        border-color: #444444;
        padding-left: 25px;
        padding-right: 20px;
        font-size: 12px;
        font-weight: normal;
    }
    1 Reply Last reply
    0
    • C Offline
      C Offline
      Craetor
      wrote on last edited by
      #2

      Any solutions?

      I can shift the text by padding-left. I also need to shift the icon. I try to search style sheet example, but no any cases. What i should to do?

      alt text

      J.HilkJ 1 Reply Last reply
      0
      • C Craetor

        Any solutions?

        I can shift the text by padding-left. I also need to shift the icon. I try to search style sheet example, but no any cases. What i should to do?

        alt text

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by
        #3

        @Craetor
        hi, according to the QStyleSheet example the correct way to target the itcon should either be QMenu::icon or QMenu::indicator did you set any of those in your stylsheet?


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        2
        • C Offline
          C Offline
          Craetor
          wrote on last edited by
          #4

          @J-Hilk
          hi, thanks for example, it works:

          QMenu::icon {
              padding-left: 5px;
          }
          
          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