Change QPushButton Icon on hover and pressed

后端 未结 5 1352
攒了一身酷
攒了一身酷 2021-02-10 02:34

I\'m trying to change the Icon of a QpushButton on hover and pressed, I\'m using QtDesigner with stylesheets. I tried this

QpushButton{
       qproperty-icon:ur         


        
5条回答
  •  难免孤独
    2021-02-10 03:04

    In c++ , we can achieve it using the following code:

    ui->button->setStyleSheet("QPushButton{border-image : url(./default_Img.png);} QPushButton:hover{border-image : url(./hover_Img.png); }"
                                   "QPushButton:focus{border-image : url(./focus_Img.png);}");
    

提交回复
热议问题