效果图:
核心代码(懒,类名默认):
-
QtGuiApplication7::QtGuiApplication7(QWidget *parent)
-
: QWidget(parent)
-
{
-
ui.setupUi(
this);
-
flag_satrt =
1;
-
ui.pushButton_2->setStyleSheet(
"border-image: url(:/QtGuiApplication7/6624c737b28d33a265e4904e43d616db.png);");
-
}
-
-
void QtGuiApplication7::on_pushButton_2_pressed()
-
{
-
-
if (flag_satrt)
-
{
-
ui.pushButton_2->setStyleSheet(
"border-image: url(:/QtGuiApplication7/2.png);");
-
flag_satrt =
0;
-
}
-
else
-
{
-
ui.pushButton_2->setStyleSheet(
"border-image: url(:/QtGuiApplication7/6624c737b28d33a265e4904e43d616db.png);");
-
flag_satrt =
1;
-
}
-
}
转载:https://blog.csdn.net/HHT0506/article/details/104580407
查看评论