How to set image on QPushButton ?
The size of the button will be correct, to reisze the icon pixmap size:
QPixmap pixmap("image_path"); QIcon ButtonIcon(pixmap); button->setIcon(ButtonIcon); button->setIconSize(pixmap.rect().size());
Try this code:
QPushButton *button = new QPushButton; button->setIcon(QIcon(":/icons/...")); button->setIconSize(QSize(65, 65));
The given below code is simple:
QPixmap pixmap("image_path"); QIcon ButtonIcon(pixmap); button->setIcon(ButtonIcon); button->setIconSize(pixmap.rect().size()); button->setFixedSize(pixmap.rect().size());