PySide6||QPushButton的QSS样式

1、狗狗拜按钮

QQ202484-03338 (online-video-cutter.com)

/* QPushButton的基本样式 */  
QPushButton {  
    background-image:url(:/xxx/第1帧.png); /* 设置背景图片 */  
    background-repeat: no-repeat; /* 不重复背景图片 */  
    background-position: center; /* 将背景图片居中 */  
    border: none; /* 移除边框,如果需要边框请自行设置 */  
    /* 其他样式,如字体、内边距等 */  
    font-size: 16px;  
    padding: 10px; /* 根据需要调整内边距 */  
}  
  
/* QPushButton在鼠标悬停时的样式 */  
QPushButton:hover {  
 	background-image:url(:/xxx/第2帧.png);
}  
  
/* QPushButton在被按下时的样式 */  
QPushButton:pressed {  
 	background-image:url(:/xxx/第1帧.png);
}  
  
/* 如果需要禁用状态的样式 */  
QPushButton:disabled {  
    /* 设置禁用状态的样式 */  
    background-image: url('path_to_disabled_background.png'); /* 可能的禁用状态图片 */  
    color: gray; /* 更改文字颜色为灰色 */  
}

2、 

/* 默认按钮样式 */  
QPushButton {  
    background-color: #555; /* 背景色设置为 #555 */  
    color: white; /* 文字颜色设置为白色 */  
    border: 1px solid #333; /* 边框颜色设置为 #333,宽度为1px */  
    border-radius: 6px; /* 边框圆角 */  
    padding: 3px 6px; /* 内边距 */  
}  
  
/* 鼠标悬停时的样式 */  
QPushButton:hover {  
    background-color: #888; /* 背景色加深为 #666 */  
    border-color: #555; /* 边框颜色也稍微加深 */  
}  
  
/* 按钮被按下时的样式 */  
QPushButton:pressed {  
    background-color: #333; /* 背景色变为更深的 #333 */  
    border-color: #222; /* 边框颜色也相应变深 */  
}  
  
/* 禁用状态的按钮样式 */  
QPushButton:disabled {  
    background-color: #888; /* 背景色变为较浅的灰色 #888 */  
    color: #ccc; /* 文字颜色变浅 */  
    border-color: #666; /* 边框颜色也相应变浅 */  
}

3、

QPushButton {  
    background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,  
                                      stop: 0 #ff8080, stop: 1 #ff0000); /* 红色渐变背景 */  
    color: white; /* 文字颜色 */  
    border: none; /* 去除边框 */  
    border-radius: 10px; /* 圆角边框 */  
    padding: 10px 20px; /* 内边距 */  
    font-size: 16px; /* 字体大小 */  
    font-weight: bold; /* 字体加粗 */  
    transition: background-color 0.3s ease-in-out; /* 背景色过渡效果 */  
}  
  
QPushButton:hover {  
    background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,  
                                      stop: 0 #ff0000, stop: 1 #800000); /* 加深的红色渐变 */  
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* 添加阴影效果 */  
}  
  
QPushButton:pressed {  
    background-color: #800000; /* 按下时的背景色 */  
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.2); /* 按下时的内阴影效果 */  
}  
  
QPushButton:disabled {  
    background-color: #ccc; /* 禁用时的背景色 */  
    color: #888; /* 禁用时的文字颜色 */  
}

图片素材:

  • 5
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值