You could use an event filter, Here is an example :
In the constructor of your class where you put the pushbutton
@ pushButton->installEventFilter(this);@
Then add this definition in the cpp file of yourClass(derived from QMainWindow in this example). Don't forget it's declaration.
@bool YourClass::eventFilter(QObject *object, QEvent *event)
{
if (pushButton == object && event->type() == QEvent::Resize) {
qDebug() << "button was resized!";
pushButton->setIconSize( QSize( pushButton->size().width(),
pushButton->size().height() ));
}
return QMainWindow::eventFilter(object, event);
}@