How to change IconSize of QToolButton

Suresh picture Suresh · Jan 15, 2014 · Viewed 21.9k times · Source

How to change the IconSize of QToolButton.

button1->setIcon(QIcon("download.jpg"));
button1->setFixedSize(100,100);

By using above code button size is getting change but icon inside the button is not changing.

Answer

dvvrd picture dvvrd · Jan 15, 2014

How about

button1->setFixedSize(100,100);
button1->setIconSize(QSize(100, 100));

If your button lays on the toolbar then use

toolBar->setIconSize(QSize(100, 100));

instead of button icon size changing. If you want to have different sizes on the toolbar then vary them with setFixedSize(). Of course the maximal of them should be QToolBar icon size.