Qt World Summit: Register Today!

Change the default icon size

  • 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;
                return QProxyStyle::pixelMetric(metric, option, widget);

  • I solved using PM_ButtonIconSize.

  • Lifetime Qt Champion

    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.

  • 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 ♥

Log in to reply