QPushButton的hover鼠标悬停效果

本文介绍了如何使用QSS样式表为QPushButton设置鼠标悬停(hover)效果,通过更改背景图片实现按钮在不同状态下的视觉变化。
摘要由CSDN通过智能技术生成

QPushButton#AddShopInfoBtn
{
    background-image: url(:/images/add_shop_data_normal.png);
    border: none;
    background-repeat: no-repeat;
    min-height: 28px;
    min-width: 100px;
    max-width: 100px;
    max-height: 28px;
}
QPushButton#AddShopInfoBtn:hover
{
    background-image: url(:/images/add_shop_data_hover.png);
    border: none;
    background-repeat: no-repeat;
    min-height: 24px;
    min-width: 81px;
    max-width: 81px;
    max-height: 24px;

}



        QString stylesheet("QPushButton#RestoreBtn {margin: 0 0 0 0; padding: 0 0 0 0; border: none; background-color : transparent; background-image: url(:/images/maxbtn_normal.png) ;background-repeat: no-repeat; min-height: 18px; min-width: 17px; max-height: 18px; max-width: 17px; } QPushButton#RestoreBtn:hover {     background-image: url(:/images/maxbtn_hover.png); } QPushButton#RestoreBtn:pressed     { background-image: url(:/images/maxbtn_pressed.png); }");
        ui.RestoreBtn->setStyleSheet(stylesheet);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值