飞道的博客

Qt按钮暂停与播放

394人阅读  评论(0)

效果图: 

 核心代码(懒,类名默认):


  
  1. QtGuiApplication7::QtGuiApplication7(QWidget *parent)
  2. : QWidget(parent)
  3. {
  4. ui.setupUi( this);
  5. flag_satrt = 1;
  6. ui.pushButton_2->setStyleSheet( "border-image: url(:/QtGuiApplication7/6624c737b28d33a265e4904e43d616db.png);");
  7. }
  8. void QtGuiApplication7::on_pushButton_2_pressed()
  9. {
  10. if (flag_satrt)
  11. {
  12. ui.pushButton_2->setStyleSheet( "border-image: url(:/QtGuiApplication7/2.png);");
  13. flag_satrt = 0;
  14. }
  15. else
  16. {
  17. ui.pushButton_2->setStyleSheet( "border-image: url(:/QtGuiApplication7/6624c737b28d33a265e4904e43d616db.png);");
  18. flag_satrt = 1;
  19. }
  20. }

 


转载:https://blog.csdn.net/HHT0506/article/details/104580407
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场