欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 美食 > PySide6||QPushButton的QSS样式

PySide6||QPushButton的QSS样式

2024/10/25 20:23:52 来源:https://blog.csdn.net/m0_56230886/article/details/141036726  浏览:    关键词: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; /* 禁用时的文字颜色 */  
}

图片素材:

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com