设置QPushbutton按钮背景、鼠标滑过状态、鼠标点击后状态用法

修改图片方法:
ui->pushButton_3->setStyleSheet(“QPushButton{border-image: url(:/new/prefix1/image/pause_press.png);}”//显示
“QPushButton:hover{border-image: url(:/new/prefix1/image/show_lyc_press.png);}”//鼠标停留
“QPushButton:pressed{border-image: url(:/new/prefix1/image/start_press.png);}”);//鼠标按下

修改颜色的方法:
ui->pushButton_3->setStyleSheet(“QPushButton{border-image: url(:/new/prefix1/image/pause_press.png) 0 0 0 0;border:none;color:rgb(255, 255, 255);}”
“QPushButton:hover{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}”
“QPushButton:checked{background-color: rgb(20, 62, 134);border:none;color:rgb(255, 255, 255);}”);

你可能感兴趣的:(QT)