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 change icon size in QMenu's action item?
Forum Updated to NodeBB v4.3 + New Features

How to change icon size in QMenu's action item?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 718 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.
  • A Offline
    A Offline
    ahmed.khan
    wrote on last edited by ahmed.khan
    #1

    Hello,

    I've created a QMenu with three actions and set icons to the actions using the setIcon method. The problem is that I am not able to adjust the size of the icons in the QMenu. Is there a way to change it?

    Thanks.

    {Please help me if anyone has any idea about it.}

    Christian EhrlicherC 1 Reply Last reply
    0
    • A ahmed.khan

      Hello,

      I've created a QMenu with three actions and set icons to the actions using the setIcon method. The problem is that I am not able to adjust the size of the icons in the QMenu. Is there a way to change it?

      Thanks.

      {Please help me if anyone has any idea about it.}

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Afaics a menu always has a standard icon size which can not be changed (only by the style via PM_SmallIconSize for all icons) but I also don't see a need for it - I never saw a menu with different icon sizes.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      A 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        Afaics a menu always has a standard icon size which can not be changed (only by the style via PM_SmallIconSize for all icons) but I also don't see a need for it - I never saw a menu with different icon sizes.

        A Offline
        A Offline
        ahmed.khan
        wrote on last edited by ahmed.khan
        #3

        @Christian-Ehrlicher, In my use case i am setting up SVG as icons but they don't appear in their actual size.

        Could you please elaborate an example on PM_SmallIconSize or suggest any alternatives?

        I was trying to work around using QMenu's paintEvent but it didn't work either. :(

        Christian EhrlicherC 1 Reply Last reply
        0
        • A ahmed.khan

          @Christian-Ehrlicher, In my use case i am setting up SVG as icons but they don't appear in their actual size.

          Could you please elaborate an example on PM_SmallIconSize or suggest any alternatives?

          I was trying to work around using QMenu's paintEvent but it didn't work either. :(

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @ahmed-khan said in How to change icon size in QMenu's action item?:

          Could you please elaborate an example on PM_SmallIconSize or suggest any alternatives?

          There is no alternative. PM_SmallIconSize is defined by the used style as you can see here: https://doc.qt.io/qt-6/qstyle.html#PixelMetric-enum

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          A 2 Replies Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @ahmed-khan said in How to change icon size in QMenu's action item?:

            Could you please elaborate an example on PM_SmallIconSize or suggest any alternatives?

            There is no alternative. PM_SmallIconSize is defined by the used style as you can see here: https://doc.qt.io/qt-6/qstyle.html#PixelMetric-enum

            A Offline
            A Offline
            ahmed.khan
            wrote on last edited by
            #5

            @Christian-Ehrlicher thanks for the help, I will look into it.

            One more question, I'v used QMenu's paintEvent for round corners. The problem is that the resulting round corners are not properly smooth. I've used QRegion and QPainterPath in the paintEvent to set menu's mask using setMask.

            A 1 Reply Last reply
            0
            • A ahmed.khan

              @Christian-Ehrlicher thanks for the help, I will look into it.

              One more question, I'v used QMenu's paintEvent for round corners. The problem is that the resulting round corners are not properly smooth. I've used QRegion and QPainterPath in the paintEvent to set menu's mask using setMask.

              A Offline
              A Offline
              ahmed.khan
              wrote on last edited by ahmed.khan
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                @ahmed-khan said in How to change icon size in QMenu's action item?:

                Could you please elaborate an example on PM_SmallIconSize or suggest any alternatives?

                There is no alternative. PM_SmallIconSize is defined by the used style as you can see here: https://doc.qt.io/qt-6/qstyle.html#PixelMetric-enum

                A Offline
                A Offline
                ahmed.khan
                wrote on last edited by
                #7
                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