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. Change the default icon size
Qt 6.11 is out! See what's new in the release blog

Change the default icon size

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 2.6k Views 2 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.
  • M Offline
    M Offline
    Mr Gisa
    wrote on last edited by
    #1

    I was wondering how can I change the default icon size of my widgets such as QPushButton and so on?
    I tried to create a custom proxy style like this but it didn't work:

    int IconProxyStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
    {
        switch (metric) {
        case QStyle::PM_SmallIconSize:
                return 30;
            break;
        default:
                return QProxyStyle::pixelMetric(metric, option, widget);
            break;
        }
    }
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mr Gisa
      wrote on last edited by
      #2

      I solved using PM_ButtonIconSize.

      1 Reply Last reply
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        Just as a note.
        You can also in Designer, set the icon size on a button and drag it
        to the left side widget list to have a template with other standard values than normally.

        1 Reply Last reply
        1
        • M Offline
          M Offline
          Mr Gisa
          wrote on last edited by Mr Gisa
          #4

          I'm not using the Qt Designer, I'm more used to do everything in code. I'm not much of a WYSIWYG user, but thank you ♥

          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