QToolButton icon size is not fitting the buttons' dimensions
I have added a QToolButton to a QWidget on a QToolBar. Now I'm trying to add a icon to the QToolButton, but the icon is not fitting the buttons' dimensions even though the size of the button is almost same as the button. I'ev added the image in resource file under :/imgs/. Below I've produced the code for perusal.
Kindly help me with this. Thank you.
Code:
m_pbSummary->setFixedSize(SUMMARY_BUTTON_WIDTH, SUMMARY_BUTTON_HEIGHT);
m_pbSummary->setStyleSheet("QToolButton {color: #333; border: 2px solid #555; border-radius: 11px; padding: 5px; background: qradialgradient(cx: 0.3, cy: -0.4,fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #fff, stop: 1 #888); min-width: 80px;}"
"QToolButton:hover {background: qradialgradient(cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, radius: 1.35, stop: 0 #fff, stop: 1 #bbb);}"
"QToolButton:pressed { background: qradialgradient(cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1, radius: 1.35, stop: 0 #fff, stop: 1 #ddd);}");
m_pbSummary->setToolButtonStyle(Qt::ToolButtonIconOnly);
m_pbSummary
->setIcon
(QIcon(":/imgs/summary.png"));
Re: QToolButton icon size is not fitting the buttons' dimensions
I've solved it by using setIconSize().
Thank you.