QT5 设置按钮图标自适应大小

QPushButton *button = new QPushButton(this);
button->setGeometry(50, 50, 100, 50);
button->setStyleSheet("border-image:url(:/timg.jpg)");
connect(button, &QPushButton::pressed, [=](){
    button->setStyleSheet("border-image:url(:/myico.ico)");}
);
connect(button, &QPushButton::released, [=](){
    button->setStyleSheet("border-image:url(:/timg.jpg)"); }
);

你可能感兴趣的:(漫漫QT路)